当前位置: 动力学知识库 > 问答 > 编程问答 >

affiliate - Commission Junction Simple Pixel Magento

问题描述:

Let me start by saying I am NOT a programmer. I'm a retail web manager that knows enough about HTML5 to understand what is going on. Ok now on to my issue. We recently upgraded our eCommerce platform from 3DCart to Magento. It's a completely different monster and I'm fairly lost. I'm trying to integrate Magento's simple pixel (just returns the total not the individual items) into our confirmation page but all of our tests are failing. I've tried bits and pieces of other codes that I've found around the web but I'm still missing the "amount" parameter. Can anyone help me? Below is what we have on our site now (please note this is part of the copy/paste code I've found):

//-------------------------------------------

// START CJ CONVERSION TRACKING PIXEL

//-------------------------------------------

$cjmerchID = '1521251';

$cjaid = '382643';

$cjorder = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());

$cjitems = $cjorder->getAllItems();

$cjorderID = $cjorder->getIncrementId();

//$cjsubtotal = round($cjorder->getSubtotal(), 2);

$i = 1;

foreach ($cjitems as $itemId => $item)

{

$unitPrice = round($item->getPrice(), 2);

$sku = $item->getSku();

$qty = $item->getQtyToInvoice();

//echo $qty . '<br>';

$itemsStr .= '&ITEM;' . $i . '=' . $sku . '&AMT;' . $i . '=' . $unitPrice . '&QTY;' . $i . '=' . $qty . '';

$i++;

}

?>

?<img src="https://www.emjcd.com/u?CID=<?php echo $cjmerchID; ?>&OID;=<?php echo $cjorderID; ?>&TYPE;=<?php echo $cjaid; ?><?php echo $itemsStr; ?>&CURRENCY;=USD&METHOD;=IMG" height="1" width="20">

<?php

//-------------------------------------------

// END CJ CONVERSION TRACKING PIXEL

//-------------------------------------------

According to CJ this is what I'm doing wrong:

Thank you for providing the results of your test. I am seeing the pixel calls on our server. However, both tests failed as the incorrect Action ID is being used and the 'AMOUNT' parameter has no associated value and is being passed back blank. I've attached the integration instructions for your convenience.

The Action ID for the simple action that should be integrated to replace the existing pixel is 382643.

Integration Test

Advertiser: 3448671

Ad: 12313358

Action Id: 346589

Action Type: item_sale

Query String: AMOUNT=&OID=100056687&CID=1521251&CURRENCY=USD&METHOD=IMG&TYPE=346589

Sid: TrackingTest

Surfer: 476602316150531682:VJXkXAhFHzU2 Click Ref:

Action Status: active

img src="https://www.emjcd.com/u?AMOUNT=&CID=1521251&OID=100056687&TYPE=346589&CURRENCY=USD&METHOD=IMG" height="1" width="20"

Please update the pixel to pull in the subtotal (pre-taxed amount of purchase) and to have 'TYPE' populated with 382643.

Any help you can give would me most appreciated!

Diana

网友答案:

See if this code works. what i did is get the subtotal of total checkout order and append a new parameter in img href with AMOUNT. Let me know how the results work out

//-------------------------------------------
// START CJ CONVERSION TRACKING PIXEL
//-------------------------------------------

$cjmerchID = '1521251';
$cjaid = '382643';
$cjorder = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
$cjitems = $cjorder->getAllItems();
$cjorderID = $cjorder->getIncrementId();
//New Codee
$totals = Mage::getSingleton('checkout/cart')->getQuote()->getTotals();
$subtotal = $totals["subtotal"]->getValue();

//$cjsubtotal = round($cjorder->getSubtotal(), 2);
$i = 1;
foreach ($cjitems as $itemId => $item)
{
    $unitPrice = round($item->getPrice(), 2);
    $sku = $item->getSku();
    $qty = $item->getQtyToInvoice();
    //echo $qty . '<br>';
    $itemsStr .= '&ITEM;' . $i . '=' . $sku . '&AMT;' . $i . '=' . $unitPrice . '&QTY;' . $i . '=' . $qty . '';
    $i++;
}
?>

    ?<img src="https://www.emjcd.com/u?CID=<?php echo $cjmerchID; ?>&OID;=<?php echo $cjorderID; ?>&TYPE;=<?php echo $cjaid; ?>&AMOUNT;=<?php echo $subtotal; ?><?php echo $itemsStr; ?>&CURRENCY;=USD&METHOD;=IMG" height="1" width="20">

<?php
//-------------------------------------------
// END CJ CONVERSION TRACKING PIXEL
//-------------------------------------------
分享给朋友:
您可能感兴趣的文章:
随机阅读: