Jump to content

Has any one intergrated google checkout....


s_ainley87

Recommended Posts

Hello,

 

I am making an online store, and I have managed to intergrate the googlecheckout HTML API to work with my PHP cart that I made....the only problem is that the checkout will only process the last item that was added to the cart, i think it may have something to with the loop or one of the variables however my brain is fried I was hoping someone would point me in the right direction?

 

	$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>';
}


?>

 

Thank you very much, a stressed s_ainley87

Link to comment
https://forums.phpfreaks.com/topic/102567-has-any-one-intergrated-google-checkout/
Share on other sites

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.