Integartion plugin

Integration with X-Cart (ver. 5+) is easy with the original plugin that you can download for free from https://market.x-cart.com/addons/post-affiliate-pro-integration.html

In case you do not want to use the integration plugin, you can integrate your store with sale tracking script placed into the order confirmation page. To do so you can follow the next integration steps.

1.

Find the template file

Find and open file \var\run\skins\default\en\checkout\success\parts\invoice.tpl.php.

If you use a custom skin which has it's own checkout\success\parts\invoice.tpl.php file then you have to integrate that one.

2.

Order tracking

Put the following code to the end of the file:

  <!-- Post Affiliate Pro tracking snippet -->
<script id="pap_x2s6df8d" src="http://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 $this->getOrder()->getPaidTotal() ?>');
sale.setOrderID('<?php echo $this->getOrder()->getOrderNumber() ?>');
PostAffTracker.register();
</script>
  <!-- /Post Affiliate Pro tracking snippet -->

If you want to track email use this variable:
$this->getComplex('order.profile.login')

If you want to track currency use this variable:
$this->getOrder()->getCurrency()->code

3.

Per product tracking

If you want to track your order per product, you have to use this code:

  <!-- Post Affiliate Pro tracking snippet -->
    <script id="pap_x2s6df8d" src="http://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript"></script>
    <script type="text/javascript">PostAffTracker.setAccountId('Account_ID');var sale = PostAffTracker.createSale();
      <?php
      $i = 1;
      foreach ($this->getOrder()->getItems() as $item) {
        echo "var sale$i = PostAffTracker.createSale();
        sale$i.setTotalCost(''".$item->getTotal()."'');
        sale$i.setOrderID('".$this->getOrder()->getOrderNumber()."($i)');
        sale$i.setProductID('".$item->getSku()."');
        $i++;
      }
      ?>
      PostAffTracker.register();
    </script>
  <!-- /Post Affiliate Pro tracking snippet -->

Please note the per product integration does not include any discounts. The price of each product is a basic one, multiplied with product quantity ordered.


Do not forget to integrate your pages with the click tracking code.