View Single Post
  #4  
Old 06-19-2008, 02:33 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.

UPDATE:

I have had some progress, but I still need some help with looping the product info in the url.

I have it sending the information I want to google, but it only sends the data for the first product. If I add more than one product, only the first product data shows in the URL.

I have attached the XML that is sent to google, you can see that there are three items in the cart, but the CJ tracking url only passes data for the first product. This is because I dont know how to loop the product data in the xml element. (I am not a programmer)

I have also attached a copy of my gcheckout.php that contains the code.

The url sent to google checkout looks like this:

https://www.emjcd.com/u?CID=24145&TYPE=5000&ITEM1=GB-ORSW2-SET&AMT1=84.95&QTY1=1&CURRENCY=USD&amp ;METHOD=IMG

I need it to look like this:

https://www.emjcd.com/u?CID=24145&TYPE=5000&ITEM1=GB-ORSW2-SET&AMT1=84.95&QTY1=1&ITEM2=ITEM2SKU&a mp;AMT2=ITEM2PRICE&QTY2=ITEM2QTY&ITEM3=ITE M3SKU&AMT3=ITEM3PRICE&QTY3=ITEM3QTY&CU RRENCY=USD&METHOD=IMG

There needs to be something like the {$smarty.foreach.pr.iteration} I like I used in my order_message.tpl to attach a number to the ITEM AMT QTY parts, then it needs to loop for each item in the cart. I have no idea how to loop the data inside an XML element because I am not that familiar with PHP. I have modified the gcheckout.php to include an additional foreach statement to generate the xml, this snippit of code is:

First I added this code inside the foreach used in the item area...

$_qty = func_google_encode($_product['amount']);
$_sku = func_google_encode($_product['productcode']);
$_prc = func_google_encode($_product['display_price']);
$num = $num + 1;

Then just above where the XML is put together I added this code:

$purls =<<<OUT
<parameterized-url
url="https://www.emjcd.com/u?CID=24145&amp;TYPE=5000&amp;ITEM1=$_sku&amp;AMT1 =$_prc&amp;QTY1=$_qty&amp;CURRENCY=USD&amp;METHOD= IMG">
<parameters>
<url-parameter name="orderID" type="order-id"/>
</parameters>
</parameterized-url>
OUT;

Then the code is put together using the $purls:

$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>429557754455455</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=$u nique_id</continue-shopping-url>
$tax_tables
<parameterized-urls>
$purls
<parameterized-url
url="https://www.googleadservices.com/pagead/conversion/107074459/?label=purchase&amp;script=0">
</parameterized-url>
</parameterized-urls>
</merchant-checkout-flow-support>
</checkout-flow-support>
</checkout-shopping-cart>
XML;

The second googleadservices parameterized url is a static url, the first of several I am going to add once I solve this first problem.

I hope this helps us solve the problem. So close...

Looking forward to your responses...

BunnyburyBaby
Attached Files
File Type: php gcheckout-sample.php (16.7 KB, 165 views)
File Type: txt gcheckout-sampleXML.txt (5.2 KB, 164 views)
__________________
X-Cart Version 4.1.8
Reply With Quote