Results 1 to 9 of 9
  1. #1
    Join Date
    Jun 2009
    Posts
    275
    Plugin Contributions
    0

    Default Only allow certain shipping methods for some countries?

    Hello,

    I am hoping there is a way to offer certain shipping methods to specific countries using the USPS mod. I would like it so some countries with questionable Postal Service would be blocked from using First Class International mail. So, for example Germany would be allowed to choose whatever shipping method they wish but the Russian Federation would only be allowed to choose Priority Mail or higher. I'm assuming this can be done using zone rates but I'm not sure where to begin. A point in the right direction would be great! Thank you!

  2. #2

    Default Re: Only allow certain shipping methods for some countries?

    Hi,

    Go to Admin >> Location/Taxes >> Zones Definitions
    Add a new Zone there
    Then, click on the folder icon next to the zone name you recently added
    and start adding countries to the zone.

    These are the countries that will be allowed to use the shipping module.
    Then, go to Admin >> Modules >> Shipping
    Select your Shipping Module and click Edit
    Set the Zone you recently added as Shipping Zone for the module and click Update

  3. #3
    Join Date
    Jun 2009
    Posts
    275
    Plugin Contributions
    0

    Default Re: Only allow certain shipping methods for some countries?

    Hi,

    Thanks for the help but I don't want to block these countries, I want it so they are not allowed to choose First Class International for shipping, only Priority International or higher...maybe I'm missing something...

  4. #4
    Join Date
    Jun 2009
    Posts
    275
    Plugin Contributions
    0

    Default Re: Only allow certain shipping methods for some countries?

    Hi,

    Thanks for the help but I don't want to block these countries, I want it so they are not allowed to choose First Class International for shipping, only Priority International or higher...maybe I'm missing something...

  5. #5
    Join Date
    Jun 2009
    Posts
    275
    Plugin Contributions
    0

    Default Re: Only allow certain shipping methods for some countries?

    Thought I'd give this a *bump*

    Anyone have any ideas?

    Thanks!

  6. #6
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Only allow certain shipping methods for some countries?

    In the shipping module:
    /includes/modules/shipping/usps.php

    Let's say you want to skip First-Class on Russia (RU) and Czech Republic (CS) ... you can customize the code around line 545 with:
    if ($this->usps_countries == 'US' && MODULE_SHIPPING_USPS_FIRST_CLASS_FILTER_US == 'True' && preg_match('#First\-Class#i', $type) && $cnt_first > 1) continue;


    // bof: skip First Class based on Country
    $skip_first_class = false;
    if ($this->usps_countries == 'CZ' || $this->usps_countries == 'RU') {
    $skip_first_class = true;
    }
    if (preg_match('#First\-Class.*(?!GXG|International)#i', $type) && $skip_first_class) {
    // skip first class
    } else {
    $methods[] = array('id' => $type_rebuilt,
    'title' => $title,
    'cost' => $cost,
    );
    }
    // eof: skip First Class based on Country
    } else {
    //echo 'MISSING! USPS $type: ' . $type . (in_array($type, $this->typeCheckboxesSelected) ? ' YES' : ' NO') . ' $method: ' . $method . ' $usps_shipping_weight: ' . $usps_shipping_weight . ' $minweight: ' . $minweight . ' $maxweight: ' . $maxweight . '<br>';
    }
    } // end for $i to $PackageSize

    if (sizeof($methods) == 0) return false;
    Last edited by Ajeh; 21 Sep 2013 at 05:05 PM.
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  7. #7
    Join Date
    Jun 2009
    Posts
    275
    Plugin Contributions
    0

    Default Re: Only allow certain shipping methods for some countries?

    Hey Ajeh!

    Sorry for the delay but I hadn't checked the thread in a while.

    Works perfect! Thank you!!!

    Now for adding more countries, do I add that whole code each time or is there a way to add multiple countries to this?

    // bof: skip First Class based on Country
    $skip_first_class = false;
    if ($this->usps_countries == 'CZ' || $this->usps_countries == 'RU') { <---- Can I add more countries here?
    $skip_first_class = true;
    }
    if (preg_match('#First\-Class.*(?!GXG|International)#i', $type) && $skip_first_class) {
    // skip first class
    } else {
    $methods[] = array('id' => $type_rebuilt,
    'title' => $title,
    'cost' => $cost,
    );
    }
    // eof: skip First Class based on Country

  8. #8
    Join Date
    Jun 2009
    Posts
    275
    Plugin Contributions
    0

    Default Re: Only allow certain shipping methods for some countries?

    Oops! Disregard the last post, I need to start paying closer attention as you answered my question in your first post. Works perfect... Thank you!

  9. #9
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Only allow certain shipping methods for some countries?

    Thanks for the update that this worked for you and glad you caught on to the how to do extras part ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

 

 

Similar Threads

  1. Replies: 6
    Last Post: 16 Jul 2015, 04:29 AM
  2. Only allow order from certain countries
    By thevikas in forum Managing Customers and Orders
    Replies: 3
    Last Post: 6 Oct 2010, 04:18 PM
  3. Shipping only to certain countries
    By realforever in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 20 Oct 2009, 08:02 PM
  4. Only allow one shipping option for certain items - HELP!!
    By elliot in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 11 Jul 2008, 06:02 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR