Results 1 to 10 of 14

Hybrid View

  1. #1
    Join Date
    Jun 2011
    Posts
    2
    Plugin Contributions
    0

    help question Restrict Shipping of a category of products from certain states

    Hello,

    I am using version 1.3.9. I am setting up a store for someone who is selling personal protection items. He will only have about 50 products total.

    There are some items (10 at most) he cannot ship to certain states. I will most likely be using the free shipper module because my client is setting his prices manually. I am open to suggestion.

    I know that the zones is for countries, but these products will only be sold in the US. So I need a way to restrict them based on category and state somehow.

    I would like people to be able to purchase those items in any state, but restrict them from shipping to a few states.

    Can anyone point me in the right direction? I have seen a few posts asking for similar things, but they are very old and there don't seem to be any answers.

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

    Default Re: Restrict Shipping of a category of products from certain states

    Assuming you have your shop setup correctly to use the FREE SHIPPING! freeshipper shipping module ...

    Let's assume that products_id 12, 22, 27 or 122 cannot be shipped to Florida zone_id 18 and New York zone_id 43 cannot be shipped to ...

    You could customize the FREE SHIPPING! freeshipper with the following code in red:
    Code:
            if ($check_flag == false) {
              $this->enabled = false;
            }
          }
    
    // bof: do not show if products_id 12, 22, 27 or 122 are in the cart
          if (!IS_ADMIN_FLAG) {
            global $cart;
            $chk_products_in_cart = $_SESSION['cart']->get_product_id_list();
            $chk_products = '12, 22, 27, 122';
            $arr1 = explode(", ", $chk_products);
            $arr2 = explode(", ", $chk_products_in_cart);
            $donotshow = array_intersect($arr1, $arr2);
    
            // do not show florida 18 and new york 43
            $chk_delivery_zone = $order->delivery['zone_id'];
            $chk_states = '18, 43';
            $arr1 = explode(", ", $chk_states);
            $arr2 = explode(", ", $chk_delivery_zone);
            $donotshow_state = array_intersect($arr1, $arr2);
            if ((int)$donotshow_state && (int)$donotshow) {
              $this->enabled = false;
            }
          }
    // eof: do not show if products_id 12, 22, 27 or 122 are in the cart
    
        }
    
    // class methods
        function quote($method = '') {
    Not the neatest code, but it gets the job done ...
    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!]
    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!

  3. #3
    Join Date
    Jun 2011
    Posts
    2
    Plugin Contributions
    0

    Default Re: Restrict Shipping of a category of products from certain states

    Okay, Great! I didn't expect such a thorough reply. I will give this a try. Thank you so much!

  4. #4
    Join Date
    May 2010
    Location
    Sydney
    Posts
    2
    Plugin Contributions
    0

    Default Re: Restrict Shipping of a category of products from certain states

    Hi there,

    I also found this really useful and it works a treat, thank you.

    Only thing is orders that include products with attributes are still allowed to go through.

    Not sure if I've missed something obvious but I can't seem to get my head around it. Any tips?
    Last edited by troymo; 30 Jun 2011 at 10:18 AM. Reason: typo

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

    Default Re: Restrict Shipping of a category of products from certain states

    Instead, try using:
    Code:
    // bof: do not show if products_id 12, 22, 27 or 122 are in the cart
          if (!IS_ADMIN_FLAG) {
            global $cart;
    
            $chk_products_in_cart = 0;
            $chk_products_in_cart += $_SESSION['cart']->in_cart_check('products_id', '12');
            $chk_products_in_cart += $_SESSION['cart']->in_cart_check('products_id', '22');
            $chk_products_in_cart += $_SESSION['cart']->in_cart_check('products_id', '27');
            $chk_products_in_cart += $_SESSION['cart']->in_cart_check('products_id', '122');
    
            // do not show florida 18 and new york 43
            $chk_delivery_zone = $order->delivery['zone_id'];
            $chk_states = '18, 43';
            $arr1 = explode(", ", $chk_states);
            $arr2 = explode(", ", $chk_delivery_zone);
            $donotshow_state = array_intersect($arr1, $arr2);
            if ((int)$donotshow_state && $donotshow > 0) {
              $this->enabled = false;
            }
          }
    // eof: do not show if products_id 12, 22, 27 or 122 are in the cart
    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!]
    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!

  6. #6
    Join Date
    May 2010
    Location
    Sydney
    Posts
    2
    Plugin Contributions
    0

    Default Re: Restrict Shipping of a category of products from certain states

    Apologies for the delayed reply here.

    Still couldn't get this to work using the amended code above.

    Sorry to be a bother, is there another way I can try?

 

 

Similar Threads

  1. v151 Can I restrict certain shipping modules for certain products?
    By gumboot in forum Built-in Shipping and Payment Modules
    Replies: 10
    Last Post: 13 Feb 2013, 05:26 AM
  2. restrict shipping certain products to certain states?
    By airtime in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 18 Jan 2011, 05:11 AM
  3. Is it possible to restrict certain items to be sold in specific US states?
    By iscatech in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 30 Sep 2010, 02:21 AM
  4. Restrict Country IP's from Certain Category
    By Ruthless in forum General Questions
    Replies: 1
    Last Post: 13 Jan 2010, 02:35 PM
  5. shipping of certain products restricted to certain states?
    By jaxon in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 3 Jul 2007, 05:08 AM

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