$GLOBALS[CC_SESSION_NAME],"cart_order_id" => $order->mkOrderNo()); $cart = new GoogleCart($merchant_id, $merchant_key, $server_type, $merchant_private_data); // Add items to the cart if(is_array($altCheckoutInv)){ /* $altCheckoutInv[$i]['taxType']; // to work out tax tables $altCheckoutInv[$i]['name']; $altCheckoutInv[$i]['options']; $altCheckoutInv[$i]['quantity']; $altCheckoutInv[$i]['price']; $altCheckoutInv[$i]['private_data'] */ $taxTypes = array(); for($i=1;$i<=count($altCheckoutInv);$i++) { $item = new GoogleItem($altCheckoutInv[$i]['name'], $altCheckoutInv[$i]['options'], $altCheckoutInv[$i]['quantity'], $altCheckoutInv[$i]['price'], $money = $config['defaultCurrency'], $private_data = $altCheckoutInv[$i]['private_data'], $tax_selector = "rule_".$altCheckoutInv[$i]['taxType'] ); $cart->AddItem($item); $taxTypes[$altCheckoutInv[$i]['taxType']] = TRUE; } // build tax rules and let fun fun commence if(is_array($taxTypes)) { foreach($taxTypes as $key => $value) { if($config_tax_mod['status']==1) { // Google checkout only supports US sellers right now $query = "SELECT t.tax_percent, c.iso, county_id, shipping FROM ".$glob['dbprefix']."CubeCart_tax_rates t LEFT JOIN ".$glob['dbprefix']."CubeCart_iso_countries c ON t.country_id = c.id WHERE `type_id` = 1 AND `active` = 1 AND c.iso = 'US' ORDER BY tax_percent DESC"; $taxRates = $db->select($query); if($taxRates==TRUE) { for($i=0;$iSetStateAreas($states); unset($states); } } $tax_table = new GoogleTaxTable("alternate","rule_".$key, $standalone = "true"); $tax_table->AddTaxRules($tax_rule); $cart->AddTaxTables($tax_table); } } else { $taxRate = $db->select("SELECT percent FROM ".$glob['dbprefix']."CubeCart_taxes WHERE `id` = ".$db->mySQLsafe($key)); $countryIso = getCountryFormat($config['taxCountry'],"id","iso"); if($config['taxCounty']==0 && $countryIso == "US"){ $country_area = "ALL"; } else { $country_area = ""; } $tax_rule = new GoogleTaxRule("alternate", ($taxRate[0]['percent']*0.01), $country_area, $shipping_taxed="false"); if($config['taxCounty']>0){ $stateCode = countyAbbrev($config['taxCounty']); $tax_rule->SetStateAreas($stateCode); } else { // state required to set country?!!? No sense AT all. $tax_rule->SetStateAreas("FALSE"); } $tax_table = new GoogleTaxTable("alternate","rule_".$key, $standalone = "true"); $tax_table->AddTaxRules($tax_rule); $cart->AddTaxTables($tax_table); } } } if(is_array($altShippingPrices)) { for($i=0;$iSetAllowedCountryArea("ALL"); $cart->AddShipping($ship); } } if($module['debug']==1) { // echo XML out echo "

XML -> Google Checkout

".htmlspecialchars($cart->GetXML())."
"; } // Display Google Checkout button return $cart->CheckoutButtonCode($module['size']); } } } ?>