Add Linkshare Pixel To Magento

Add this code to:
\app\design\frontend\enterprise\<your theme>\template\checkout\success.phtml

$order = Mage::getModel('sales/order')->load($order_id);
$_totalData = $order->getData();

/*linkshare vars*/
$skus = array();
$qtys = array();
$amounts = array();

foreach ($order->getAllItems() as $item) {
        $skus[$item->getProductId()] = $item->getSku();
	$names[$item->getProductId()] = rawurlencode($item->getName());
	$qtys[$item->getProductId()] = $item->getQtyOrdered() * 1;
	$amounts[$item->getProductId()] = $item->getRowTotal() * 100;	

$order_id = $_totalData['increment_id'];

$skuspipe = implode("|", $skus);
$namespipe = implode("|", $names);
$qtyspipe = implode("|", $qtys);
$amountspipe = implode("|", $amounts);

Make sure to replace ‘xxxx’ with your own Merchant Id number

Code modified/corrected from this post .

, ,

6 responses to “Add Linkshare Pixel To Magento”

  1. Hello! is an excelent solution! but i have a question related with discount coupons…How can integrate a discount made in the total? Because if my product cost 10 the discount is fr 4, the pixel only takes the 10 with out the discount.

  2. Hello! Do you use Twitter? I’d like to follow you if that would be okay. I’m undoubtedly enjoying your blog and look forward to new posts. aageddekadkg

  3. You’re so interesting! I don’t think I have read anything like this before. So wonderful to discover somebody with some unique thoughts on this subject matter. Seriously.. thank you for starting this up. This website is one thing that is needed on the internet, someone with a bit of originality! ddfagegdakge

  4. It’s hard to find your posts in google. I found it on 17
    spot, you should build quality backlinks , it will help you to get more visitors.
    I know how to help you, just type in google
    – k2 seo tricks

  5. Thank you! I’ve just been reading the linkshare implimentation pdf and was scratching my head trying to figure out how to do the skupipe and qty pipe.

    Thank you again!

Leave a Reply

Your email address will not be published. Required fields are marked *