<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>david schultz dot org &#187; Magento</title>
	<atom:link href="http://www.davidschultz.org/category/magento/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.davidschultz.org</link>
	<description>(dot com was taken)</description>
	<lastBuildDate>Thu, 29 Jul 2010 18:23:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>How to install Google Affiliate pixel tracking code in Magento</title>
		<link>http://www.davidschultz.org/2009/11/12/how-to-install-google-affiliate-pixel-tracking-code-in-magento/</link>
		<comments>http://www.davidschultz.org/2009/11/12/how-to-install-google-affiliate-pixel-tracking-code-in-magento/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 01:55:01 +0000</pubDate>
		<dc:creator>David Schultz</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[troubleshooting]]></category>

		<guid isPermaLink="false">http://www.davidschultz.org/?p=317</guid>
		<description><![CDATA[Took me a day of scouring the web to figure out how to get this to work. After adding this code do a test order and view source and confirm it worked. #copy and paste to the bottom of #app/design/frontend/default/theme_name/template/checkout/success.phtml $companyID = "K123456"; #provided by Google $category = urlencode("Your product category"); $lastorderid = Mage::getSingleton('checkout/session')->getLastOrderId(); $_order [...]

<h3>Related Posts:</h3>
<ol>
		<li><a href="http://www.davidschultz.org/2008/03/28/google-improves-streetmaps-2/" rel="bookmark">Google improves streetmaps</a><!-- (4.60055)--></li>
		<li><a href="http://www.davidschultz.org/2009/10/16/the-best-marketing-is-none-at-all/" rel="bookmark">The best marketing is none at all</a><!-- (3.80556)--></li>
		<li><a href="http://www.davidschultz.org/2008/03/14/in-a-crowded-market-clarity-doesnt-sell/" rel="bookmark">In a crowded market clarity doesn&#8217;t sell</a><!-- (3.71909)--></li>
	</ol>
]]></description>
			<content:encoded><![CDATA[<p>Took me a day of scouring the web to figure out how to get this to work.  After adding this code do a test order and view source and confirm it worked.</p>
<pre name="code" class="php">
#copy and paste to the bottom of
#app/design/frontend/default/theme_name/template/checkout/success.phtml
$companyID = "K123456"; #provided by Google
$category = urlencode("Your product category");
$lastorderid = Mage::getSingleton('checkout/session')->getLastOrderId();
$_order = Mage::getModel('sales/order')->load($lastorderid);
$orderID = $this->getOrderId(); #get the order ID
$aProduct = array();
$totalAmt = 0;
$prdsku = "";
$prdnm = "";
$prdqn = "";
$prdpr = "";
$prcatid = "";

###########store order data in array of objects###########
foreach ($_order->getAllItems() as $item) {
	$oProduct = new stdClass();
	$oProduct->sku = $item->getSku(); #sku
	$oProduct->price = $item->getPrice(); #price
	$totalAmt = $totalAmt + ($oProduct->price * $item->getQtyOrdered()); #total amt (excl.tax/shipping)
	$oProduct->qty = $item->getQtyOrdered(); #quantity
	$oProduct->name = $item->getName(); #product name
	$oProduct->category = $category;
	array_push($aProduct, $oProduct);
	$oProduct = NULL; #nuke it
}
###########build query string variables###########
for ($i=0; $i < count($aProduct); $i++) {
	if ($i == count($aProduct)-1) {
		$prdsku .= urlencode($aProduct[$i]->sku);
		$prdnm .= urlencode($aProduct[$i]->name);
		$prdqn .= urlencode($aProduct[$i]->qty);
		$prdpr .= urlencode($aProduct[$i]->price);
		$prcatid .= urlencode($aProduct[$i]->category);
	} else {
		$prdsku .= urlencode($aProduct[$i]->sku) . "^";
		$prdnm .= urlencode($aProduct[$i]->name) . "^";
		$prdqn .= urlencode($aProduct[$i]->qty) . "^";
		$prdpr .= urlencode($aProduct[$i]->price) . "^";
		$prcatid .= urlencode($aProduct[$i]->category) ."^";
	}
}
?>

<img src="https://clickserve.cc-dt.com/link/order?vid=<?=$companyID?>&#038;oid=<?=$orderID?>&#038;amt=<?=urlencode($totalAmt)?>&#038;prdsku=<?=$prdsku?>&#038;prdnm=<?=$prdnm?>&#038;prdqn=<?=$prdqn?>&#038;prdpr=<?=$prdpr?>&#038;prcatid=<?=$prcatid?>" width=1 height=1>
</pre>


<h3>Related Posts:</h3>
<ol>
		<li><a href="http://www.davidschultz.org/2008/03/28/google-improves-streetmaps-2/" rel="bookmark">Google improves streetmaps</a><!-- (4.60055)--></li>
		<li><a href="http://www.davidschultz.org/2009/10/16/the-best-marketing-is-none-at-all/" rel="bookmark">The best marketing is none at all</a><!-- (3.80556)--></li>
		<li><a href="http://www.davidschultz.org/2008/03/14/in-a-crowded-market-clarity-doesnt-sell/" rel="bookmark">In a crowded market clarity doesn&#8217;t sell</a><!-- (3.71909)--></li>
	</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.davidschultz.org/2009/11/12/how-to-install-google-affiliate-pixel-tracking-code-in-magento/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.868 seconds -->
