View Single Post
  #5  
Old 06-27-2008, 12:22 PM
  BunnyburyBaby's Avatar 
BunnyburyBaby BunnyburyBaby is offline
 

Advanced Member
  
Join Date: Nov 2007
Location: Los Angeles
Posts: 32
 

Default Re: Google Checkout - How to add tracking info.

Ok folks, 80 points later... I have the solution.

Here are the sections dealing with tracking multiple products:

First, add to the foreach item loop in gcheckout.php:

BEFORE:
Code:
$length = 160; if (strlen($_descr) > $length) { $_descr = substr($_descr, 0, $length); } $_title = func_google_encode($_product['product']); $_descr = func_google_encode($_descr); if (!empty($_product['taxes'])) { .....


AFTER:
Code:
$length = 160; if (strlen($_descr) > $length) { $_descr = substr($_descr, 0, $length); } $_title = func_google_encode($_product['product']); $_descr = func_google_encode($_descr); $_qty = func_google_encode($_product['amount']); $_sku = func_google_encode($_product['productcode']); $_prc = func_google_encode($_product['display_price']); $_counter++; $_tracking_xml .= "&ITEM$_counter=$_sku&AMT$_counter=$_prc&QTY$_counter=$_qty&CURRENCY=USD"; if (!empty($_product['taxes'])) {

Then add a new XML section:
BEFORE:
Code:
$shipping_xml = "<shipping-methods>\n$shipping_xml\n\t\t\t</shipping-methods>\n"; } } $cart_xml = <<<XML <?xml version="1.0" encoding="UTF-8"?> <checkout-shopping-cart xmlns="http://checkout.google.com/schema/2"> <shopping-cart> <merchant-private-data> <merchant-note>$unique_id</merchant-note> </merchant-private-data> <items> $items </items> </shopping-cart> <checkout-flow-support> <merchant-checkout-flow-support> <platform-id>429557754556845</platform-id> <request-buyer-phone-number>true</request-buyer-phone-number> $shipping_xml $merchant_calculations_xml <edit-cart-url>$xcart_catalogs[customer]/cart.php</edit-cart-url> <continue-shopping-url>$current_location/payment/ps_gcheckout_return.php?mode=continue&#x26;skey=$unique_id</continue-shopping-url> $tax_tables </merchant-checkout-flow-support> </checkout-flow-support> </checkout-shopping-cart> XML;

AFTER:
Code:
$shipping_xml = "<shipping-methods>\n$shipping_xml\n\t\t\t</shipping-methods>\n"; } } $purls =<<<OUT <parameterized-url url="https://www.emjcd.com/u?CID=5000&amp;TYPE=214213$_tracking_xml&amp;METHOD=IMG"> <parameters> <url-parameter name="orderID" type="order-id"/> </parameters> </parameterized-url> OUT; $cart_xml = <<<XML <?xml version="1.0" encoding="UTF-8"?> <checkout-shopping-cart xmlns="http://checkout.google.com/schema/2"> <shopping-cart> <merchant-private-data> <merchant-note>$unique_id</merchant-note> </merchant-private-data> <items> $items </items> </shopping-cart> <checkout-flow-support> <merchant-checkout-flow-support> <platform-id>429557754556845</platform-id> <request-buyer-phone-number>true</request-buyer-phone-number> $shipping_xml $merchant_calculations_xml <edit-cart-url>$xcart_catalogs[customer]/cart.php</edit-cart-url> <continue-shopping-url>$current_location/payment/ps_gcheckout_return.php?mode=continue&#x26;skey=$unique_id</continue-shopping-url> $tax_tables <parameterized-urls> $purls <parameterized-url url="https://www.googleadservices.com/pagead/...label=purchase&amp;script=0"> </parameterized-url> </parameterized-urls> </merchant-checkout-flow-support> </checkout-flow-support> </checkout-shopping-cart> XML;

This solution allows me to put in many different urls for tracking from various sources. All I need to do is add a new <parameterized-url> entry for each item I need tracked. If my tracking requires the products as well then I add it to the $purls section.

A few things left to fix:

First: I would like the display_price to be the discounted price after coupons or discounts. This involves creating an if statement, if discount do this, otherwise display regular price. The code eludes me.

Second: I have yet to figure out how to get the Marketing Manager module by Firetank to track orders through google checkout. Right now when I track sales the orders placed through GC do not show up at all in the Marketing Manager. If anyone knows please post it here.

Thanks folks!

Bunnyburybaby.com
__________________
X-Cart Version 4.1.8
Reply With Quote