Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2011
    Posts
    383
    Plugin Contributions
    0

    Default Shipping option based on category/product

    I need help setting up some shipping option:

    My store offers delivery but i want certain products to also be available for pick-up.

    All the product available for pick-up are in one category (i.e category 1)

    Let s say Product #10 from category # 1 is in the cart, then shipping for this product should be delivery and pick-up but if there is a product from another category in the cart, only delivery is available.

    I looked at this old threads https://www.zen-cart.com/showthread....rtain-products

    but it does the opposite of what i want.

    Only the product from category # 1 should have delivery and pick up , all other category or mixed cart should only be available for delivery.

    Hope this makes sense somehow.

    Any advice or pointers would be appreciated

    Thank you for your help

  2. #2
    Join Date
    Apr 2011
    Posts
    383
    Plugin Contributions
    0

    Default Re: Shipping option based on category/product

    After some digging, I came up with this:

    In module/shipping/storepickup.php,

    i added at line 92 the following:

    Code:
      // other status checks?
        if ($this->enabled) {
    		 // enable for one master_categories_id
          if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('master_categories_id','166') > 0)) {
              $this->enabled = true;
          } else {
            $this->enabled = false;
          } 
          // other checks here
    Not sure if that s correct way to do it though?

    So far it turns on "store pickup" for product with master category 166 and off for all other master categories.

    However, it getting complicated for mixed cart. How do i deal with these?

    Thank you

  3. #3
    Join Date
    Oct 2008
    Location
    Croatia
    Posts
    1,542
    Plugin Contributions
    19

    Default Re: Shipping option based on category/product

    Quote Originally Posted by nicksab View Post
    So far it turns on "store pickup" for product with master category 166 and off for all other master categories.
    Wasn't that the expected outcome?

    Quote Originally Posted by nicksab View Post
    However, it getting complicated for mixed cart. How do i deal with these?
    Thank you
    What happens when it's a mixed cart, can you explain what you get vs what you're expecting?

  4. #4
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,693
    Plugin Contributions
    9

    Default Re: Shipping option based on category/product

    PHP Code:
        // only enable for master_categories_id 1
        // also note category is a string not a integer
        
    $productsArray $_SESSION['cart']->get_products();

        
    $this->enabled true;
        foreach (
    $productsArray as $product) {
            if (
    $product['category'] !== '1') {
                
    $this->enabled false;
                break;
            }
        } 
    you are welcome.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  5. #5
    Join Date
    Apr 2011
    Posts
    383
    Plugin Contributions
    0

    Default Re: Shipping option based on category/product

    i got it to work by creating a category named "all products" with id #1 and made it the master category for all the product ( kind of obvious)

    Then i created a category named "store pick up"with id #2 and use the following code

    Code:
      // other status checks?
        if ($this->enabled) {
    		 // enable for one master_categories_id
          if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('master_categories_id','1') > 0)) {
              $this->enabled = false;
          }
    By mixed cart, i meant the following scenario:

    ~if product from #1 only in cart, no pick-up available

    ~if product from #2 only, pick-up available

    ~if product from 1and 2, no pick-up available

    My previous code was allowing pick up as soon as product from #2 was in cart even if it was mixed with product fom #1

    Hope it makes sense.

  6. #6
    Join Date
    Apr 2011
    Posts
    383
    Plugin Contributions
    0

    Default Re: Shipping option based on category/product

    Thank you, Carl.

    I will have to give it a try. I saw something in the forrum with "array" before but could not figure out to set it up with the extra function part.

  7. #7
    Join Date
    Apr 2011
    Posts
    383
    Plugin Contributions
    0

    Default Re: Shipping option based on category/product

    Quote Originally Posted by carlwhat View Post
    PHP Code:
        // only enable for master_categories_id 1
        // also note category is a string not a integer
        
    $productsArray $_SESSION['cart']->get_products();

        
    $this->enabled true;
        foreach (
    $productsArray as $product) {
            if (
    $product['category'] !== '1') {
                
    $this->enabled false;
                break;
            }
        } 
    you are welcome.
    Thank you, Carl.

    I will have to give it a try. I saw something in the forrum with "array" before but could not figure out to set it up with the extra function part.

 

 

Similar Threads

  1. v155 Restrict Shipping option for product category
    By gpsllc in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 26 Mar 2017, 09:01 AM
  2. Replies: 22
    Last Post: 12 Apr 2010, 04:45 PM
  3. Payment based upon shipping option
    By mrmyles in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 17 Aug 2009, 05:09 AM
  4. Offer Shipping Option based on Category
    By arizonagranny in forum Setting Up Categories, Products, Attributes
    Replies: 9
    Last Post: 31 May 2009, 01:37 PM

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