Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Google Checkout shipping rates fix

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 06-18-2009, 10:51 PM
 
necroflux necroflux is offline
 

Advanced Member
  
Join Date: Feb 2009
Posts: 47
 

Default Google Checkout shipping rates fix

Well I know a ton of people have given up on Google Checkout because of the whole 3 second timeout on shipping calculations - well I have a solution - simply create the XML code yourself for the shipping rates instead of letting X-cart generate it dynamically. In gcheckout.php, after:

Code:
<merchant-calculated-shipping name="{$_ship_method['shipping']}"> <price currency="{$config['Google_Checkout']['gcheckout_currency']}">{$_ship_method['rate']}</price> <address-filters> <allowed-areas> <world-area /> </allowed-areas> </address-filters> </merchant-calculated-shipping> OUT; }

We will be overriding this previous calculation and totally defining the $shipping_methods variable ourselves. Here's my example (and this would be pasted directly below the above code):


Code:
$shipping_xml = "<shipping-methods>\n"; //Set up free shipping if order total is > $100 if($cart["subtotal"]>="100") { $shipping_xml.="<flat-rate-shipping name=\"UPS Ground\"> <price currency=\"USD\">0.00</price> <shipping-restrictions> <allowed-areas> <us-country-area country-area=\"CONTINENTAL_48\"/> </allowed-areas> </shipping-restrictions> </flat-rate-shipping>"; } else { $shipping_xml.="<flat-rate-shipping name=\"UPS Ground\"> <price currency=\"USD\">7.95</price> <shipping-restrictions> <allowed-areas> <us-country-area country-area=\"CONTINENTAL_48\"/> </allowed-areas> </shipping-restrictions> </flat-rate-shipping>"; } $shipping_xml.= "<flat-rate-shipping name=\"UPS 2nd Day Air\"> <price currency=\"USD\">15.00</price> <shipping-restrictions> <allowed-areas> <us-country-area country-area=\"CONTINENTAL_48\"/> </allowed-areas> </shipping-restrictions> </flat-rate-shipping> <flat-rate-shipping name=\"UPS Next Day Air Saver\"> <price currency=\"USD\">30.00</price> <shipping-restrictions> <allowed-areas> <us-country-area country-area=\"CONTINENTAL_48\"/> </allowed-areas> </shipping-restrictions> </flat-rate-shipping> <flat-rate-shipping name=\"UPS 2nd Day Air (Alaska, Hawaii)\"> <price currency=\"USD\">25.00</price> <shipping-restrictions> <allowed-areas> <us-state-area> <state>HI</state> </us-state-area> <us-state-area> <state>AK</state> </us-state-area> </allowed-areas> </shipping-restrictions> </flat-rate-shipping> \n\t\t\t</shipping-methods> \n";

Basically, this gives:

To the continental US:
-- $7.95 Ground shipping for orders under $100
-- Free Ground shipping for orders above $100
-- $15 2nd day air shipping
-- $30 next day shipping

To Hawaii and Alaska:
-- $25 2nd day air shipping

This has worked 100% of the time, the shipping variables are loaded in with the initial XML request so I don't think the 3 second rule even applies here. To test it anyway, I hammered the checkout button about 30 times in 5 seconds, and every single tab loaded the shipping rates correctly (some tabs taking up to a minute to load). Seems pretty rock solid.

I've used an if/then statement for the order total to give free shipping on orders above a certain amount, but you could also work in other rules based on your own needs, even using the total shipping weight and manually setting up tiered shipping rates with XML to simulate calculated rates if necessary.

Hope this helps you guys out!
__________________
-----------------
X-cart version 4.2.1
Reply With Quote
  #2  
Old 09-02-2009, 03:25 PM
 
joestern joestern is offline
 

Senior Member
  
Join Date: Apr 2004
Posts: 185
 

Default Re: Google Checkout shipping rates fix

When you implemented this fix, do your x-cart-generated invoices show the correct shipping total and method?

Every xcart invoice for a google order shwos 0.00 for shipping, regardless of the shipping method actually purchased/chosen in google.

Thanks.
__________________
X-Cart version 4.7.12
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 06:55 AM.

   

 
X-Cart forums © 2001-2020