Posts Tagged ‘directtrack’

Hello Guys,

Today i’ll show you how to add affiliate code in checkout success page.

Below is the code for Product Specific Campaign setup for magento.

Open success.phtml from PATH:  Yourproject/app/design/frontend/package/theme/template/checkout/success.phtml.

Add Below code at the end of file.

We need to display below image code at checkout success page.

<img src="http://yourdomain.directtrack.com/i_prod/yourdomainname/PRODUCT_STRING/TRANSACTION_ID/OPTIONAL_INFO">  
<?php /****** START::  Affiliate  *******/?>
<?php  if($_orderID = $this->getOrderId()) {
$url = 'https://yourdomain.directtrack.com/i_prod/yourdomainname/';
$_order =  Mage::getModel('sales/order')->loadByIncrementId($_orderID);?>
<?php  $_items = $_order->getItemsCollection(); ?>
<?php $querystring='';
foreach ($_items as $_item):  ?>
<?php $querystring .='prod:'.$_item->getSku().':qty:'.$_item->getQtyOrdered();?>
<?php endforeach; ?>
<?php $querystring.= '/'.$_orderID;?>
<?php $url = $url.$querystring;?>
<img src="<?php echo $url?>" />
<?php }?>
<?php /****** END *********/?>

Thanks,
Bijal Bhavsar 🙂

Advertisements