I'm integrating the sample code
I want to enable merchant-private-item-data,so that i can pass the userid,period and attribute
I'm not able to understand how do i do it .
My googlecheckout button appears here as given below.:
require_once($jconfig->gc_path.'/googlecart.php');
require_once($jconfig->gc_path.'/googleitem.php');
require_once($jconfig->gc_path.'/googleshipping.php');
require_once($jconfig->gc_path.'/googletax.php');
$merchant_id = "SAMPLE"; // Your Merchant ID
$merchant_key = "SAMPLE"; // Your Merchant Key
$server_type = "sandbox";
$currency = "USD";
$cart = new GoogleCart($merchant_id, $merchant_key, $server_type,
$currency);
$total_count = 1;
$item_1 = new GoogleItem('title', // Item name
'descriptiom',
$price,
1);
$cart->AddItem($item_1);
$cart->SetContinueShoppingUrl($jconfig->response_handler.$generate_url);
// Request buyer's phone number
$cart->SetRequestBuyerPhone(true);
// Display Google Checkout button
//echo $this->product[0]['welcome_pack']+$this->product[0]['airport_pick_up']+$this->product[0]['airport_drop_off']+$this->product[0]['textbooks']+$totle;
echo $cart->CheckoutButtonCode("SMALL");
Do I have to enable it in googlecart.php?
If you look at the source, you'll see a
GoogleItem::SetMerchantPrivateItemData
, which simply sets theGoogleItem::$merchant_private_item_data
property. ExaminingGoogleItem::GetXML
revealsGoogleItem::$merchant_private_item_data
can be aMerchantPrivate
(which appears to be unimplemented, but you can write your own as long as it has aMerchantPrivate::AddMerchantPrivateToXML(gc_XmlBuilder $xml)
method) or a string, which (after a pass throughhtmlentities
) becomes the content of themerchant-private-item-data
element. If you want to structure your private data with XML, you'll have to implement classMerchantPrivate
.