Integration with X-Cart (ver. 5+) is made by placing the sale tracking script into the order confirmation page.

1.

Find the template file

Find and open file varrunskinsdefaultencheckoutsuccesspartsinvoice.tpl.php.

If you use a custom skin which has it's own checkoutsuccesspartsinvoice.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.