Page 1 of 3 123 LastLast
Results 1 to 10 of 27
  1. #1
    Join Date
    Jan 2007
    Posts
    11
    Plugin Contributions
    0

    Default How to force expedited shipping for certain products?

    Hi there! I have a chocolate shop that sells two kinds of products: truffles and dark chocolates. The dark chocolates can be shipped out via regular priority mail, but truffles have to go out via 2 day express (shipped with ice packs.)

    I had no trouble setting up the two shipping methods, but putting notices throughout the site saying "IF YOU ORDER TRUFFLES, YOU MUST CHOOSE EXPEDITED SHIPPING!" isn't working.

    How do I add a rule to Zen Cart that says,

    "If the order contains 1 or more truffles, disable the option for priority shipping. Only allow in-store pickup and express shipping."

    Thanks very much for your help. I'm sure this question comes up from time to time, but I wasn't able to find anything out in the forums.

    - canton
    http://www.kakawachocolates.com

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

    Default Re: How to force expedited shipping for certain products

    You would have to have something in the products or products_description table that can be checked or used as a flag for the order and if that something exists then the shipping module can be set to skip that option ...

    What shipping module(s) are you using?

    Do you have something that can be checked to see if it is in the product to know let's skip that shipping method? Or does something need to be added?
    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!

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

    Default Re: How to force expedited shipping for certain products

    Peeking at your site ... are all truffles always in categories_id 2

    If so, you could use that as a trigger in the shipping module ...

    If you do not use Linked Products this is made even easier as the master_categories_id will always be 2 ... and that can be the trigger ...
    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!

  4. #4
    Join Date
    Jan 2007
    Posts
    11
    Plugin Contributions
    0

    Default Re: How to force expedited shipping for certain products

    Quote Originally Posted by Ajeh View Post
    What shipping module(s) are you using?
    Thanks for the reply! I'm using the USPS module only. (Well, that and in-store pickup.)

    - canton

  5. #5
    Join Date
    Jan 2007
    Posts
    11
    Plugin Contributions
    0

    Default Re: How to force expedited shipping for certain products

    Quote Originally Posted by Ajeh View Post
    Peeking at your site ... are all truffles always in categories_id 2

    If so, you could use that as a trigger in the shipping module ...
    Do I understand that what you are saying is that I should just modify the PHP code for the shipping module itself? I'm okay with that, I'm pretty handy with PHP, but I was wondering if there was any way to do this from within the regular set of administrative interfaces?

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

    Default Re: How to force expedited shipping for certain products

    There is a nice function in the shopping_cart class to check if something exists in the cart based on what you pass it:
    function in_cart_check($check_what, $check_value='1') {

    If you were to use this to control the shipping option(s) you want disabled by utilizing IF statements you can check if the categories_id 2 for the master_categories_id exists ...

    PHP Code:
    $_SESSION['cart']->in_cart_check('master_categories_id','2'); 
    Here is an example in the
    /includes/modules/shipping/item.php

    In the function quote, change the quote to read:
    PHP Code:
          if ($_SESSION['cart']->in_cart_check('master_categories_id','2')) {
            
    $yes 'hello world';
          }
          
    $this->quotes = array('id' => $this->code,
                                
    'module' => MODULE_SHIPPING_ITEM_TEXT_TITLE,
                                
    'methods' => array(array('id' => $this->code,
                                                         
    'title' => MODULE_SHIPPING_ITEM_TEXT_WAY $yes,
                                                         
    'cost' => (MODULE_SHIPPING_ITEM_COST $item_total_count) + MODULE_SHIPPING_ITEM_HANDLING))); 
    What this will do is say Hello World next to the title if the master_categories_id is 2 for even 1 product ...

    So if 1 product is a truffle ... you see Hello World ...

    Now what you can do is customize USPS based on the same idea ...

    Find the function quote ...

    change the code:
    PHP Code:
              $methods[] = array('id' => $type,
                                 
    'title' => $title,
                                 
    'cost' => ($cost MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes); 
    To include a test for your category for truffles
    PHP Code:
    if (($this->types[$type] == 'Priority Mail') && $_SESSION['cart']->in_cart_check('master_categories_id','2') > 0) {
      
    $skip_this true;
    } else {
      
    $skip_this false;
    }

    if (!
    $skip_this) {
              
    $methods[] = array('id' => $type,
                                 
    'title' => $title,
                                 
    'cost' => ($cost MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);

    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
    Jan 2007
    Posts
    11
    Plugin Contributions
    0

    Default Re: How to force expedited shipping for certain products

    Quote Originally Posted by Ajeh View Post
    There is a nice function in the shopping_cart class to check if something exists in the cart based on what you pass it:
    Superb! Thank you for such clear & well-exampled help.

    in your debt,
    - canton
    http://www.ontology.com

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

    Default Re: How to force expedited shipping for certain products

    You are most welcome ... hope that this got you back on track ...
    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!

  9. #9
    Join Date
    Dec 2007
    Posts
    34
    Plugin Contributions
    0

    Default Re: How to force expedited shipping for certain products

    This is almost what I need! However, I need to show "First Class Mail" if my buyer only purchases cat 2 products. The instance there are other category products in the cart, either alone or in combination, "First Class Mail" needs to be hidden.

    Is there a function other shortcut that allows me to do that without the need to list each 'other' category in my IF statement?

    Thanks.
    -- ae

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

    Default Re: How to force expedited shipping for certain products

    Do you use Linked Products?

    If so, is the master_categories_id on the products the categories_id that matters?

    There is a function in the shopping_cart class that will tell you how many matching products contain specific data from the products table where you could test how many are master_categories_id 37 and how many are in the cart ... when they match, then they are all from that specific categories_id ...

    So, in theory, yes this could be customized for something like this ...
    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!

 

 
Page 1 of 3 123 LastLast

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. v139h Force customer to use a certain Shipping for a certain category.
    By Hylt in forum Built-in Shipping and Payment Modules
    Replies: 7
    Last Post: 7 Oct 2012, 03:32 AM
  3. How can I force certain products to use a method of shipping?
    By greenne1 in forum Setting Up Categories, Products, Attributes
    Replies: 5
    Last Post: 2 Jun 2009, 08:07 PM
  4. Can I Force expedited shipping for a few products in my cart?
    By danwebman in forum Addon Shipping Modules
    Replies: 4
    Last Post: 13 Nov 2008, 05:46 AM
  5. How to disable certain payment methods for certain products?
    By AccurateOptics in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 29 Mar 2007, 06:53 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