Implement Paidonresults Affiliate tracking code


Paid On Results ( is a system which helps you manage your affiliate program and get more leads and more sales. Become a merchant in the website, you can easily find your affiliate. Paid On Results requires you to implement a tracking script in your website before starting. In this blog I will show you how to implement affiliate tracking code in Magento for

The HTML code for your Advanced Tracking Code is described as below. You need to append various parameters to the end of both URLs within the HTML which gives us the necessary order information. The required parameters are &MerchantID=,&SaleID= and &Purchases= the other parameters are all optional.

On the last stage of your order process, normally in the "thank you" or "order complete" page you need to update the server files to include tracking code and you need to update &SaleID=Your-Sale-ID and &Purchases=Purchases-Breakdown.

In Magento, you can add the following code into app/design/frontend/[YOUR_THEME_PACKAGE]/[YOUR_THEME]/template/checkout/success.phtml

   $order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
   $orderItems = $order->getItemsCollection();
   $purchases = '';
foreach ($orderItems as $item ){
    $product_id = $item->product_id;
    $product_sku = $item->sku;
    $_product = Mage::getModel('catalog/product')->load($product_id);
 $price = $_product->getPrice();
    $purchases .= "$product_sku".','."$price".'|';  
    $purchases = rtrim($purchases,'|'); 


Remember to test some times before going live. Have fun!

2 thoughts on “Implement Paidonresults Affiliate tracking code”

2 Responses to Implement Paidonresults Affiliate tracking code