Home Integration Methods ZenCart

ZenCart

Integration with ZenCart is made by placing sale tracking script into the order confirmation page.
1
Edit template
To integrate ZenCart you should edit the order confirmation template. Open the file includes/templates/template_default/templates/tpl_checkout_success_default.php
2
Locate integration place
Find the line with following code which should already exist in the file.
<div id="checkoutSuccessOrderNumber"><?php echo TEXT_YOUR_ORDER_NUMBER . $zv_orders_id; ?></div>
3
Integration
Copy & Paste the following code into the file, under the line found above:

Ok, the integration is finished. Now every time a sale occurs, the shop will call our script and register the sale commission.
4
Lifetime commissions integration
If you want to integrate the Lifetime commissions plugin, then just add the code below into the code from step 3. after this line:
$orderId = $dbreq->fields['orders_id'];

Also you need to add this code: sale.setData1(\''.$email.'\');
right after the sale.setOrderID(\''.$orderId.'\');




In case you want to know the payment method name used in the order, you can use this variable:
$orders->fields['payment_method']


5
zenCart + PayPal - part 1
In case you use PayPal as a payment gateway in ZenCart then a different integration approach is needed.

In 'zenCart_installation_directory/includes/functions/html_output.php' find the following line:

$field = '<input type="hidden" name="' . zen_sanitize_string(zen_output_string($name)) . '"';

and replace it with this one:

6
zenCart + PayPal - part 2
Into 'zenCart_installation_directory/includes/templates/template_default/common/tpl_footer.php' add the following code:
7
zenCart + PayPal - part 3
Into 'zenCart_installation_directory/ipn_main_handler.php' add the following code:
That's it. 
Now, log in to the merchant panel of Post Affiliate Pro (Network), navigate to the "Plugins" section and activate the "PayPal IPN Handling" plugin.

NOTE: If you wish to enable Lifetime Commission integration when using this 'zenCart + PayPal' integration method, then in the configuratoin of  "PayPal IPN Handling" plugin turn on the 'Support lifetime commission' option.
Do not forget to integrate your site with the click tracking code to make the sale tracking working correctly.