Support » Plugins and Hacks » Simple Cart & Buy Now » [Resolved] Google Wallet Shipping UK, EU, Worldwide?

[Resolved] Google Wallet Shipping UK, EU, Worldwide?

  • Hi

    We’ve pretty much got this plugin working to how we want, there is one final thing that we are a little confused about and haven’t found quite want we want after looking through the support threats. We want 3 simple shipping options via Google Wallet which are shipping for UK, Europe and Wordwide. The shipping options in templates/default.php don’t seem to really accommodate UK/EU in the variables, is there a simple way we can set these variables?

    Thanks for a great little plugin.


Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author bluey80


    In the templates/defaults.php file, the function for setting shipping options is

    function getShippingOptions($items) {
    	$ship[]=array("name" => "USPS Standard Shipping", "price" => "5", "region" => "all");
    	$ship[]=array("name" => "USPS Priority Shipping (USA Only)", "price" => "10", "region" => "USA");
    	$ship[]=array("name" => "Global Priority (6-10 days)", "price" => "20", "region" => "NotUSA");
    	return $ship;

    Basically, it wants an array with shipping options, with each option providing a name, price and region. Currently the backend only supports ‘USA’ and ‘NotUSA’. The function that parses this array is in classes/google.php:

    foreach($shipoptions as $soption) {
                            $gc .= "\n\t<flat-rate-shipping name=\"". $soption['name'] . "\">";
                            $gc .= "\n\t<price currency=\"".$options['currency']."\">".$soption['price']. "</price>";
                            $gc .= "\n\t<shipping-restrictions>";
                            $gc .= "\n\t\t<allowed-areas>";
                            if ($soption['region'] == "USA" ) {
                                    $gc .= "\n\t\t<us-country-area country-area=\"ALL\"/>";
                            } else {
                                    $gc .= "\n\t\t<world-area/>";
                            $gc .= "\n\t\t</allowed-areas>";
                            $gc .= "\n\t\t<excluded-areas>";
                            if ($soption['region'] == "NotUSA" ) {
                                    $gc .= "\n\t\t<us-country-area country-area=\"ALL\"/>";
                            $gc .= "\n\t\t</excluded-areas>";
                            $gc .= "\n\t</shipping-restrictions>";
                            $gc .= "\n\t</flat-rate-shipping>";

    It is very easy for me to add a few other region options, assuming the google format supports them. Take a look at https://developers.google.com/checkout/developer/Google_Checkout_XML_API_Tag_Reference#tag_region and if you roughly outline what regions you want and how to structure the XML, I’ll add that to the backend class.

    Thanks for the help. I’ve had a look at the google XML layout and tried to piece together the regions it will be most applicable to. Although I’m sure it might need tidying up, I’ve input the main areas which are UK, EU (the main countries in EU) and USA (instead of rest of the world). Do you need the shipping rates for each area also? (The currency for each would be obviously GBP for UK, Euro for Europe and dollar for USA.)




    Plugin Author bluey80


    Take a look at SCABN 1.9.12 and look at the defaults.php example for setting google shipping options. Now you can pass an array with allowed-areas country codes and excluded area country codes. Should let you handle almost everything. Let me know if that works for you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Google Wallet Shipping UK, EU, Worldwide?’ is closed to new replies.
Skip to toolbar