Jump to content

Google Checkout, Google Support A Letdown :-(


s_ainley87

Recommended Posts

Hi guys,

 

I am currently intergrating a site with google checkout, i have my own php shopping basket from where the products get sent to a hidden form supplied by google, on clicking the google checkout button, it only sends the last products added, I think it has some thing do with the look that it is in. basically a loop contents how many entries are in the cart and then gives the appends that vale to end of all the google hidden field names e.g, item_description_$count represents the first copy of item description, and it should cycle adding new versions of the fields for each product that is there but this not happening, all that happens is that a new product is added and when you check out the new product is only dispalyed. I think it is something wrong with while loop?

	// Print each item.
$total = 0; // Total cost of the order.
while ($row = mysql_fetch_array ($result)) {

	$count = $count+1;
	$subtotal = $_SESSION['cart'][$row['product_id']]['quantity'] * $_SESSION['cart'][$row['product_id']]['price'];
	$total += $subtotal;

	//setting table variables
	$catname = $row['category_name'];
	$prodname = $row['product_name'];
	$price = $_SESSION['cart'][$row['product_id']]['price'];
	$quantity = $_SESSION['cart'][$row['product_id']]['quantity'];

	// Print the row.
	echo "	<tr>
	<td align=\"left\" bgcolor=\"#cccccc\">{$row['category_name']}</td>
	<td align=\"left\" bgcolor=\"#cccccc\">{$row['product_name']}</td>
	<td align=\"right\" bgcolor=\"#cccccc\">£{$_SESSION['cart'][$row['product_id']]['price']}</td>
	<td align=\"center\" bgcolor=\"#cccccc\"><input type=\"text\" size=\"3\" name=\"qty[{$row['product_id']}]\" value=\"{$_SESSION['cart'][$row['product_id']]['quantity']}\" /></td>
	<td align=\"right\" bgcolor=\"#cccccc\">£" . number_format ($subtotal, 2) . "</td>
</tr>\n";
 // End of the WHILE loop.
}
mysql_close($dbc); // Close the database connection.

// Print the footer, close the table, and the form.
echo '	<tr>
	<td colspan="4" align="right"><b>Total:<b></td>
	<td align="right">£' . number_format ($total, 2) . '</td>
</tr>
</table><div align="center"><input type="submit" name="submit" value="Update My Cart" />	
<input type="hidden" name="submitted" value="TRUE" />
</form><br /><br />';
?>
<?php

echo "<form id=\"googlecheckout\" method=\"POST\" action = \"https://checkout.google.com/api/checkout/v2/checkoutForm/Merchant/453070710704027\"
accept-charset=\"utf-8\">
<input type=\"hidden\" name=\"item_description_$count\" value=\"$catname\" />
<input type=\"hidden\" name=\"item_name_$count\" value=\"$prodname\" />
<input type=\"hidden\" name=\"item_price_$count\" value=\"$price\" />
<input type=\"hidden\" name=\"item_quantity_$count\" value=\"$quantity\"/>
<input type=\"hidden\" name=\"item_currency_$count\" value=\"GBP\"/>
<input type=\"image\" name=\"Google Checkout\" alt=\"Fast checkout through Google\"
src=\"http://checkout.google.com/buttons/checkout.gif?merchant_id=453070710704027&w=180&h=46&style=white&variant=text&loc=en_US\"
height=\"46\" width=\"180\"/>
</form>";

} else {
echo '<p>Your cart is currently empty.</p>';
}

 

any help would be great thanks

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.