• Resolved v8s_uk

    (@v8s_uk)


    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.

    http://wordpress.org/extend/plugins/simple-cart-buy-now/

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

    (@bluey80)

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

    function getShippingOptions($items) {
    	$ship=array();
    	$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.

    Thread Starter v8s_uk

    (@v8s_uk)

    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.)

    <allowed-areas>
    <postal-area>
    <country-code>GB</country-code>
    </postal-area>
    </allowed-areas>

    <allowed-areas>
    <postal-area>
    <country-code>RU</country-code>
    <country-code>DE</country-code>
    <country-code>FR</country-code>
    <country-code>ES</country-code>
    <country-code>IT</country-code>
    <country-code>UA</country-code>
    <country-code>NL</country-code>
    <country-code>GR</country-code>
    <country-code>BE</country-code>
    <country-code>PT</country-code>
    <country-code>HU</country-code>
    <country-code>AU</country-code>
    <country-code>CH</country-code>
    </postal-area>
    </allowed-areas>

    <allowed-areas>
    <postal-area>
    <country-code>US</country-code>
    </postal-area>
    </allowed-areas>

    Plugin Author bluey80

    (@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 ‘Google Wallet Shipping UK, EU, Worldwide?’ is closed to new replies.