示例#1
0
文件: complex.php 项目: saiber/www
/**
 * Create a new Cart
 */
$xml_merchant_private_data = "<item-note>Popular item: Check inventory and order more if needed</item-note>";
$GCheckout = new gCart($merchant_id, $mercant_key, '2006-12-31T23:59:59', $xml_merchant_private_data);
/**
 * Add Merchant Checkout Flow Support
 */
$GCheckout->setMerchantCheckoutFlowSupport("http://www.example.com/edit", "http://www.example.com/shopping");
/**
 * Create Item
 */
$AARechargeableBatteryPack = new gItem('Dry Food Pack AA1453', 'A pack of highly nutritious dried food for emergency - store in your garage for up to one year!!', 1, 35.0);
$AARechargeableBatteryPack_SKU = "<item-sku>SK00000001</item-sku>";
$AARechargeableBatteryPack->setPrivateItemData($AARechargeableBatteryPack_SKU);
$AARechargeableBatteryPack->setTaxTableSelector("food");
$MegaSoundPlayer = new gItem('HelloWorld 2GB MP3 Player', 'HelloWorld, the simple MP3 player', 1, 178.99);
/**
 * Add Item to Cart
 */
$GCheckout->addItems(array($AARechargeableBatteryPack, $MegaSoundPlayer));
/**
 * Create Default Tax Table
 */
$default_tax_rule = new gTaxRule(0.0775, COUNTRY_AREA_FULL_50);
$default_tax_rule->setShippingTaxed(GCHECKOUT_TRUE);
$default_tax_table = new gTaxTable("Default", array($default_tax_rule), TAX_TABLE_DEFAULT);
$GCheckout->setDefaultTaxTable($default_tax_table);
/**
 * Alternate Food Tax Tables
 */