Home Integration Methods OpenCart


This is integration method for open source shopping cart OpenCart. The integration is done by integrating files of thank you page.

For OpenCart 2.0 use the other integration method please.

You can track per product orders, lifetime commissions and also coupons.
Edit confirm action
Navigate to your cart directory catalog\controller\checkout\ and open confirm.php (for older versions also guest_step_3.php) for editing. Find this line: 
$this->data['totals'] = $total_data; 
There are two places with this line, use the second one.
Put this code below that line:
Save these files and continue with next step.

In case you use QuickCheckout you have to modify file quickcheckout.php instead of confirm.php - the integration code needs to be placed into confirm_order() function - there you will find the needed line:
$this->data['totals'] = $total_data;
mentioned at the beginning of this step.
Edit success action
Open file catalog/controller/checkout/success.php
Find this line:
  if (isset($this->session->data['order_id'])) {
It should be around line 10.
Put this code below it:
Again do not forget to save the changes and continue to  the next integration step.
Whole cart as one transaction - Edit success view
If you want to process whole payment as one transaction in PAP follow this step. If you want to create one transaction for every product skip to step 4.

Open file catalog/view/theme/default/template/common/success.tpl

Add these lines before the line which says "echo $footer;":
Save the file and your shop is integrated.

The values of  'coupon' and 'voucher' are negative, that is why we are directly adding it to the subtotal value.
One transaction per product - Edit success view
This step is not necessary if you integrated step 3.

Open file catalog/view/theme/default/template/common/success.tpl

Add these lines before the line which says "echo $footer;":
This will register a commission per each ordered product.
Do not forget to integrate your cart with the click tracking to make the sale tracking work. You can place the click tracking code to the theme footer file:

VQMod Update

3 years ago Jonathan
I am working on trying to get Opencart to give me to code the create a vqmod for this. I will update when I am done.

Created a VQMod

2 years ago VQMod Update
With the help of some people a lot smarter than me, I have created a VQMod for Opencart or Mijoshop, so you don't have to keep updating files in each opencart update.

Create an xml file, and name it what you want: affiliate.xml

Enter this code:

<author><![CDATA[ ]]></author>
<file name="catalog/controller/checkout/confirm.php">
<operation error="log">
<search position="after"><![CDATA[$this->data['totals'] = $total_data]]></search>

$this->session->data['pap4_totals'] = $total_data;
$this->session->data['pap4_products'] = $this->data['products'];

<file name="catalog/controller/checkout/success.php">
<operation error="log">
<search position="after"><![CDATA[if (isset($this->session->data['order_id'])) {]]></search>

$this->data['pap4_orderid'] = $this->session->data['order_id'];
$this->data['pap4_totals'] = $this->session->data['pap4_totals'];
$this->data['pap4_products'] = $this->session->data['pap4_products'];


Upload via FTP to: vqmod/xml directory, and install it in the backend of Opencart.

This will take care of these two files:


You will want to create your own template in the backend of Opencart for the last file. That way it won't be overwritten.


2 years ago Jonathan Colson
One more thing.

Make sure if you changed the success and confirm.php files, that you return them back to normal after you add the VQMod above, or sales will not register.

Of course, the success.tpl in your custom template will stay changed.

This is my custom template file system I named "bodybio".

I edited the success.tpl file as listed above in this new directory

I then added the tracking code from my affiliate panel in this file

Make sure to choose your custom template you have created in the opencart backend.

Use this link for the full directions on the custom template system: http://forum.opencart.com/viewtopic.php?f=139&t=36665


2 years ago Muhammad Waqas
In step 3 u have add proper url

<script id="pap_x2s6df8d" src="http://URL_TO_PostAffiliatePro/scripts/salejs.php" type="text/javascript"> </script>

replace above url with ur affiliate company url..