Individual pricing with Google Checkout

Can someone help me parse this paragraph?
Price lists can also be passed as a parameter to the GoogleCheckout() function. See also GoogleCheckoutPricelistFromString() for parsing a string into the pricelist array. This could be used, for instance, by storing a pricelist string in the 'customdata' field of your images and then parsing and passing it in the GoogleCheckout() call. This would give you individual pricing by image.
I tried, but failed, numerous times to get this working. In the custom data field for my image I entered:
20x20:canvas=400.00 30x30:canvas=600
Then there's this:
function GoogleCheckoutPricelistFromString($prices) {
$pricelist = array();
$pricelistelements = explode(' ', $prices);
foreach ($pricelistelements as $element) {
if (!empty($element)) {
$elementparts = explode('=', $element);
$pricelist[$elementparts[0]] = $elementparts[1];
}
}
return $pricelist;
}
Where do I insert this code? Sorry, I'm just a scripting dummy.
Sign In or Register to comment.