Affiliate Software Documentation
Commission Integration with OpenCart
To integrate the affiliate software with Opencart Shopping Cart, please follow these steps:
- Open up the following file for editing:
/catalog/controller/checkout/success.php - Add the following lines of code as given below in the appropriate lines of code:
<?php class ControllerCheckoutSuccess extends Controller { public function index() { $this->load->language('checkout/success'); if (isset($this->session->data['order_id'])) { //START AFFILIATE INTEGRATION $jrox = mysqli_connect(DB_HOSTNAME,DB_USERNAME,DB_PASSWORD,DB_DATABASE); $sql = 'SELECT * FROM ' . DB_PREFIX . 'order_total WHERE order_id = ' . (int)$this->session->data['order_id'] . ' AND code = \'sub_total\''; $jrox2 = mysqli_query($jrox, $sql); $sub_total = mysqli_fetch_assoc($jrox2); $aff_integrate = file_get_contents('http://www.yourdomain.com/affiliates/sale/amount/' . $sub_total['value'] . '/trans_id/' . $this->session->data['order_id'] . '/tracking_code/' . $_COOKIE['jamcom']); //END AFFILIATE INTEGRATION $this->cart->clear(); // Add to activity log $this->load->model('account/activity'); if ($this->customer->isLogged()) { $activity_data = array( 'customer_id' => $this->customer->getId(), 'name' => $this->customer->getFirstName() . ' ' . $this->customer->getLastName(), 'order_id' => $this->session->data['order_id'] );
- Make sure to change www.domain.com/affiliates to point to your installation URL.