Posts Tagged ‘affiliate’

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="">  
<?php /****** START::  Affiliate  *******/?>
<?php  if($_orderID = $this->getOrderId()) {
$url = '';
$_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 *********/?>

Bijal Bhavsar 🙂