Created
November 7, 2014 14:27
-
-
Save nickwanhere/b31f8c6ad4998c0e1a39 to your computer and use it in GitHub Desktop.
Magento Pepperjam Network Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/*********Start Pepperjam Network Codes #1 ******/ | |
$lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId(); | |
$order = Mage::getSingleton('sales/order'); | |
$order->load($lastOrderId); | |
$_totalData = $order->getData(); | |
$_currency = $_totalData['order_currency_code']; | |
$_productData = $order->getAllItems(); | |
$pixelDataItem = ''; | |
$pixelDataQty = ''; | |
$pixelDataAmount = ''; | |
$i = 1; | |
foreach ($_productData as $item){ | |
if ($item->getProductType() == 'configurable') continue; | |
if ($item->getParentItemId()) { | |
$_total = number_format($item->getParentItem()->getPrice(),2); | |
$_discount = number_format(($item->getParentItem()->getDiscountAmount() / $item->getParentItem()->getQtyOrdered()),2); | |
} else { | |
$_total = number_format($item->getPrice(),2); | |
$_discount = number_format(($item->getDiscountAmount() / $item->getQtyOrdered()),2); | |
} | |
$pixelDataItem .= '&ITEM;'.$i.'='.$item->getSku(); | |
$pixelDataQty .= '&QTY;'.$i.'='.(int)$item->getQtyOrdered(); | |
$pixelDataAmount .= '&AMOUNT;'.$i.'='.number_format($_total - $_discount,2); | |
$i++; | |
} | |
$pixelData = '<iframe src="https://t.pepperjamnetwork.com/track?'; | |
$pixelData .="PID=XXXX"; | |
$pixelData .="&INT;=ITEMIZED"; | |
$pixelData .=$pixelDataItem.$pixelDataQty.$pixelDataAmount; | |
$pixelData .= '&OID;='.$this->getOrderId().'&CURRENCY;='.$_currency.'" width="1" height="1" frameborder="0"></iframe>'; | |
echo $pixelData; | |
/*********End Pepperjam Network Codes ******/ | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment