edd12345678 Posted March 19, 2012 Share Posted March 19, 2012 Hi, I was wondering if someone can help. I am trying to implement a server to server Google checkout system on my website. I have built my own custom shopping basket which meets my needs however I need to get my data in the correct format to send off for the payment to be taken by Google checkout. At present I have a sql table called basket which stores all of the items that a user adds to thier basket. The google checkout examle requires the data in the below format: $item_1 = new GoogleItem("product name ", // Item name "With S/N", // Item description $total_count, // Quantity 10.99); // Unit price $item_1->SetURLDigitalContent('http://example.com/download.php?id=15', 'S/N: 123.123123-3213', "Download Item1"); $cart->AddItem($item_1); The above code is obviously for just the one item. Is it best to store the basket in a sql database and if so how would I go about retrieving the information from the database and then sending it to google in the above format bearing in mind there can be multiple items in the cart? Thanks in advance Edd Quote Link to comment https://forums.phpfreaks.com/topic/259249-advice-using-google-checkout/ Share on other sites More sharing options...
Muddy_Funster Posted March 19, 2012 Share Posted March 19, 2012 It shouldn't matter where you store the info, as long as you can provide an array for each item that you are p[assing to the checkout it won't make a difference. Quote Link to comment https://forums.phpfreaks.com/topic/259249-advice-using-google-checkout/#findComment-1328981 Share on other sites More sharing options...
edd12345678 Posted March 19, 2012 Author Share Posted March 19, 2012 Thankyou for your reply. Thats what I thought. What im struggling with is defining the array variable so that each row from the sql query is put into a seperate array and a new variable name for each product is created. eg. item1, item2 etc. Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/259249-advice-using-google-checkout/#findComment-1329046 Share on other sites More sharing options...
dmikester1 Posted March 19, 2012 Share Posted March 19, 2012 Why do you need seperate variable names? Will an array work? item[0], item[1], item[2]... Thanks Mike Quote Link to comment https://forums.phpfreaks.com/topic/259249-advice-using-google-checkout/#findComment-1329051 Share on other sites More sharing options...
Muddy_Funster Posted March 19, 2012 Share Posted March 19, 2012 $itemList = array(); while ($row = mysql_fetch_assoc($result)){ $itemList[] = $row; } should build you a multidimensional array, one array entry for each item array. Quote Link to comment https://forums.phpfreaks.com/topic/259249-advice-using-google-checkout/#findComment-1329059 Share on other sites More sharing options...
edd12345678 Posted March 19, 2012 Author Share Posted March 19, 2012 Thanks again for replying. I have managed to build an arra. The challenge nowi is to get the information from it in the correct format to send off to google checkouts. Is it possible to do this? I need the data displayed as below. So for each record stored in the array i will need to generate the below: $item_1 = new GoogleItem("product name ", // Item name "With S/N", // Item description $total_count, // Quantity 10.99); // Unit priceow? Thanks again for your help so far. Quote Link to comment https://forums.phpfreaks.com/topic/259249-advice-using-google-checkout/#findComment-1329107 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.