CoreCommerce integration
1st class all in one hosted shopping cart for your online ecommerce store with FTP access, shared SSL and legendary support.
Sale tracking
Open file packages/core_commerce/single_pages/checkout/finish.php and find this line:
if($previousOrder instanceof CoreCommercePreviousOrder && $previousOrder->getStatus() > 0) { ?>
Add the sale tracking code below the line:
<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript"></script>
<script type="text/javascript">
PostAffTracker.setAccountId('Account_ID');
var sale = PostAffTracker.createSale();
sale.setTotalCost('<?php echo $previousOrder->getOrderTotal(); ?>');
sale.setOrderID('<?php echo $previousOrder->getOrderID(); ?>');
PostAffTracker.register();
</script>
Save your changes and that’s it. Your thank you page has just been integrated. If you want per product integration, please use the sale tracking code from the next step.
Per product integration
The sale tracking code for per product integration is this, place it to the file described in previous step:
<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript"></script>
<script type="text/javascript">
PostAffTracker.setAccountId('Account_ID');
<?php
$i = 1;
foreach($previousOrder->getProducts() as $product) {
echo "var sale$i = PostAffTracker.createSale();";
echo "sale$i.setTotalCost('".$product->getOrderProductFinalPrice."');";
echo "sale$i.setOrderID('".$previousOrder->getOrderID()."(".$i.")');";
echo "sale$i.setProductID('".$product->getProductID()."');";
$i++;
}
?>
PostAffTracker.register();
</script>
Save your changes and that’s it. Your site has just been integrated.
PayPal with CoreCommerce 1
In case you are using PayPal as your payment gateway in CoreCommerce and you want to track it, use this integration step.
The first step is to add the tracking code to all buttons generated by CoreCommerce. To do this, edit this file:
packages/core_commerce/models/payment/methods/paypal_website_payments_standard/form.php
Add this code after the “foreach” loop:
<input type="hidden" name="custom" value="" id="pap_dx8vc2s5" />
<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/notifysale.php" type="text/javascript">
</script>
Save your changes.
PayPal with CoreCommerce 2
Now edit file controller.php (in the same directory) and find this line:
private function validateIPN() {
Add this code right below the line:
// Post Affiliate Pro integration snippet
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://URL_TO_PostAffiliatePro/plugins/PayPal/paypal.php");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST);
curl_exec($ch);
// /Post Affiliate Pro integration snippet
Save your changes. The last step is to turn on PayPal plugin in your merchant panel and configure it. That is it… Now all your payments done through PayPal will be tracked, as well as its cancellations or refunds.
HOSTED version of CoreCommerce
If you happen to have a hosted solution of CoreCommerce then the sale tracking code integration happens inside the CoreCommerce admin panel.
To integrate it this way, in CoreCommerce admin panel click ‘Settings‘ in the top right corner. At the settings page click ‘Affiliate settings‘. In this Affiliate settings page you will find a field called ‘Custom Affiliate Program Code‘ where you can place the hidden image (pixel) tracking code:
<img src="https://URL_TO_PostAffiliatePro/scripts/sale.php?AccountId=default1&TotalCost=##TOTAL_B4_TAX_SHIPPING##&OrderID=##ORDER_NUMBER##" width="1" height="1" />
Save your custom code and that’s it.
Do not forget to add the click tracking code to your theme files (header or footer).
Integrate Post Affiliate Pro with XtCommerce for seamless data transfer and enhanced affiliate tracking. Discover how to edit templates and implement code for a streamlined ecommerce experience. Enjoy exceptional support and user-friendly features with Post Affiliate Pro. Start your free trial today!