So maybe you guys can help me out here, im trying to integrate googles tracking pixel for their Google Affiliate program. Im using the following code from here http://www.studio1909.com/2009/10/16/google-affiliate-network-conversion-tracking-pixel-magento-ecommerce/ However, after going back and forth with google they aren't so excited about the way the code from the above link is printing out the data when it comes to configurable products.
<!--Start Google Affiliate Integration-->
<?php
$lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
$order = Mage::getSingleton('sales/order');
$order->load($lastOrderId);
$order = Mage::getModel('sales/order')->load($lastOrderId);
foreach ($order->getAllItems() as $item) {
$productArray[] = array(
"product_sku" => $item->getSku(),
"product_magento_id" => $item->getProductId(),
"product_name" => $item->getName(),
"product_qty" => $item->getQtyOrdered(),
"product_price" => $item->getPrice(),
"product_discount_amount" => $item->getDiscountAmount(),
"product_row_price" => $item->getPrice() - $item->getDiscountAmount(),
);
};
?>
<?php
$_totalData = $order->getData();
$_subtotal = $_totalData['subtotal'];
$_orderID = $_totalData['increment_id'];
?>
<img src="https://clickserve.cc-dt.com/link/
order?vid=KVENDORID&oid=<?php echo "$_orderID"; ?>&amt=<?php echo "$_subtotal"?>&prdsku=<?php foreach ($productArray as $key) {echo $key['product_sku']."^";};
?>&prdnm=<?php foreach ($productArray as $key) {echo $key['product_name']."^";};
?>&prdqn=<?php foreach ($productArray as $key) {echo $key['product_qty']."^";};
?>&prdpr=<?php foreach ($productArray as $key) {echo $key['product_price']."^";};
?>&prcatid=<?php foreach ($productArray as $key) {echo "your-product^";};
?>" width=1 height=1>
<!--End Google Affiliate Integration-->
This is the end result
<!--Start Google Affiliate Integration-->
<img src="https://gan.doubleclick.net/gan_conversion?advid=MYID&event_type=transaction&oid=10000XXXX&amt=19.0000&fxsrc=USD&prdsku=DVT2756CH CHAR M^DVT2756CH CHAR M^&prdnm=DaVinci 1952 In Charcoal T-Shirt^DaVinci 1952 In Charcoal T-Shirt^&prdqn=1.0000^1.0000^&prdpr=19.0000^0.0000^&prcatid=4425^4427^" width=1 height=1>
<!--End Google Affiliate Integration-->
So the question is there a way to edit the code above so it just echoes the main configurable product without the simple product.
Thanks!