Page 50 of 56 FirstFirst ... 404849505152 ... LastLast
Results 491 to 500 of 552
  1. #491
    Join Date
    Mar 2006
    Posts
    191
    Plugin Contributions
    0

    Default Re: Different shipping methods for different categories

    Hi all,

    I've read through this thread and searched it a few times, but I need some pointers for how to implement the per-category idea to the free shipping module - Note that I'm not a PHP programmer.

    I have Free Shipping Option and Free Shipping modules running on ZC 139h

    I have free shipping above $300.-

    I want to disable free shipping on items in a given category.

    I understand I can use this code with the appropriate category Id's to disable a shipping option.

    // disable for one master_categories_id
    if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('master_categories_id','4') > 0)) {
    $this->enabled = false;
    }

    What I want to know is if that is correct and where exactly to put it. I have tried it in various places in freeoptions.php and in freeshipper.php but without any luck.

    I'm testing by inserting the category ID where the target product resides, and then going through to the shipping estimator, hoping to see the free shipping option vanish, but nope!

    Any help with this is very much appreciated.
    Rob

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

    Default Re: Different shipping methods for different categories

    Free Options freeoptions is based on either the Total, Weight or Item count or a combination of the 3 ... and runs at the same time as other shipping modules ...

    In this module, you can add that code below:
    Code:
          // disable only when entire cart is free shipping
          if (zen_get_shipping_enabled($this->code)) {
              $this->enabled = ((MODULE_SHIPPING_FREEOPTIONS_STATUS == 'True') ? true : false);
          }
    FREE SHIPPING! freeshipper is based on orders of 0 amount or marked as Always Free Shipping ... and runs INSTEAD of other shipping modules ... so this code is not a good choice for this shipping module as no other shipping module would be running and if you turn it off, then there would be no shipping modules at all ...
    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. #493
    Join Date
    Mar 2006
    Posts
    191
    Plugin Contributions
    0

    Default Re: Different shipping methods for different categories

    Quote Originally Posted by Ajeh View Post
    Free Options freeoptions is based on either the Total, Weight or Item count or a combination of the 3 ... and runs at the same time as other shipping modules ...

    In this module, you can add that code below:
    Code:
          // disable only when entire cart is free shipping
          if (zen_get_shipping_enabled($this->code)) {
              $this->enabled = ((MODULE_SHIPPING_FREEOPTIONS_STATUS == 'True') ? true : false);
          }
    FREE SHIPPING! freeshipper is based on orders of 0 amount or marked as Always Free Shipping ... and runs INSTEAD of other shipping modules ... so this code is not a good choice for this shipping module as no other shipping module would be running and if you turn it off, then there would be no shipping modules at all ...
    Fantastic, thanks Ajeh!

    I was able to use that info plus some previous posts in the thread to get it to check multiple categories as follows:

    Code:
    	  // disable for one master_categories_id
    	  if (IS_ADMIN_FLAG == false) {
    	  // check master_categories_id add one line per master_categories_id
    	  $chk_cat = 0;
    	  $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','165');
    	  $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','166');
    	  if ($chk_cat >= 1) {
    	  $this->enabled = false;
    	  }
    	  }
    And that works!

    Thanks again, much appreciated
    Rob

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

    Default Re: Different shipping methods for different categories

    Thanks for the update that you have you site working now on 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!]
    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!

  5. #495
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,021
    Plugin Contributions
    32

    Default Re: Different shipping methods for different categories

    Read through this thread (yep ALL 50 pages as of this writing..)

    Wanted to do a sanity check BEFORE I test and implement this.. Does my code for these two different scenarios look correct (restriction based on model number or category ID) Client has yet to decide whether he wants to use model number or category ID, so I will be demoing both options for him..

    Disable based on multiple categories
    Code:
        //Disable based on multiple categories
         // disable only when entire cart is free shipping
          if (zen_get_shipping_enabled($this->code)) {
              $this->enabled = ((MODULE_SHIPPING_FREEOPTIONS_STATUS == 'True') ? true : false);
          }
          // test contents for Cases
           global $cart;
            $skip_free = false;
            $chk_case = 0;
            if (IS_ADMIN_FLAG == false) {
              $chk_case += $_SESSION['cart']->in_cart_check('master_categories_id','56');
              $chk_case += $_SESSION['cart']->in_cart_check('master_categories_id','60');
              if ($chk_case > 0  && ($chk_case != $_SESSION['cart']->count_contents())) {
                $skip_free = true;
              }
            }
    //echo 'FLAT : ' . $chk_case . '<br>';
          // disable for above categories
          if ((IS_ADMIN_FLAG == false && $skip_free)) {
              $this->enabled = false;
          }
    
          if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FREEOPTIONS_ZONE > 0) ) {
    Disable based on multiple model numbers
    Code:
        //Disable based on multiple model numbers
         // disable only when entire cart is free shipping
          if (zen_get_shipping_enabled($this->code)) {
              $this->enabled = ((MODULE_SHIPPING_FREEOPTIONS_STATUS == 'True') ? true : false);
          }
          // test contents for Cases
           global $cart;
            $skip_free = false;
            $chk_case = 0;
            if (IS_ADMIN_FLAG == false) {
              $chk_case += $_SESSION['cart']->in_cart_check('products_model','MH-78523');
              $chk_case += $_SESSION['cart']->in_cart_check('products_model','MH-65489');
              if ($chk_case > 0  && ($chk_case != $_SESSION['cart']->count_contents())) {
                $skip_free = true;
              }
            }
    //echo 'FLAT : ' . $chk_case . '<br>';
          // disable for above model numbers
          if ((IS_ADMIN_FLAG == false && $skip_free)) {
              $this->enabled = false;
          }
    
          if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FREEOPTIONS_ZONE > 0) ) {
    One last thing.. how would I modify this to restrict things based on a specific product ID.. Is it just a matter of doing something like this???:
    Code:
              $chk_case += $_SESSION['cart']->in_cart_check('products_id','23');
              $chk_case += $_SESSION['cart']->in_cart_check('products_id','89');
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

  6. #496

    Default Re: Different shipping methods for different categories

    Hi, I have read through all the posts and have been testing for few days but still can't a solution. Could someone please help me with my code?

    I have 3 Zone Rate, singpost, pos_malaysia and singpost_plus_posmalaysia
    1. singpost - enable for all categories except cat #20
    PHP Code:
     // bof: disable for these master_categories_id 
        
    if (IS_ADMIN_FLAG == false) {
          
    // check master_categories_id add one line per master_categories_id
          
    $chk_cat 0;
          
    $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','20');
           if (
    $chk_cat 0) {
            
    $this->enabled false;
          }
        }
        
    // eof: disable for these master_categories_id 
    2. pos_malaysia - enable when cart only have cat #20
    PHP Code:
     // bof: disable for these master_categories_id
        
    if (IS_ADMIN_FLAG == false) {
          
    // check master_categories_id add one line per master_categories_id
          
    $chk_cat 0;
          
    $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','2');
          
    $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','3');
          
    $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','4');
           
    $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','6');
          
    $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','8');
          
    $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','13');
           
    $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','14');
          
    $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','15');
          
    $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','16');
           
    $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','17');
          
    $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','18');
                           if (
    $chk_cat 0) {
            
    $this->enabled false;
          }
        }
        
    // eof: disable for these master_categories_id 
    3. singpost_plus_posmalaysia - mixed cart enable only when cart have cat #20 plus any other cat
    PHP Code:
    // bof: enable for mixed cart where cat #20 must be present plus any other cat
        
    global $db$cart;
        if (
    IS_ADMIN_FLAG == false) {
          
    // check master_categories_id add one line per master_categories_id
          
    $chk_cat 0;
          
    $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','2');
          
    $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','3');
          
    $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','4');
           
    $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','6');
          
    $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','8');
          
    $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','13');
           
    $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','14');
          
    $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','15');
          
    $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','16');
           
    $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','17');
          
    $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','18');
                         if ((
    IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('master_categories_id','20') > 0)&&(IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check($chk_cat ) > 0)) {
            
    $this->enabled true;
                          } else{
                              
    $this->enabled false;
                          }
         } 
    singpost_plus_posmalaysia is working fine if cat #20 plus 1 other cat with quantity of 1 but it will not working when
    cat #20 plus more than 2 other cat or cat #20 plus one other cat with quantity of more than 1 . Problem solved if I remove
    PHP Code:
    else{
                              
    $this->enabled false;
                          } 
    but singpost_plus_posmalaysia will appear in all other categories which not suppose to. I am going crazy, any help will be very much appreciated.

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

    Default Re: Different shipping methods for different categories

    For the test for:
    2. pos_malaysia - enable when cart only have cat #20

    use the test for is the categories_id 20 the only thing in the cart:
    Code:
          $chk_cat = 0;
          $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','20');
          if ($chk_cat > 0  && $chk_cat != $_SESSION['cart']->count_contents()) {
            $this->enabled = false;
          }
    For the test for:
    3. singpost_plus_posmalaysia - mixed cart enable only when cart have cat #20 plus any other cat

    use the test for is this a mixed cart with categories_id 20 in the cart:
    Code:
          $chk_cat = 0;
          $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','20');
          if ($chk_cat > 0  && $chk_cat == $_SESSION['cart']->count_contents()) {
             $this_enabled = false;
          }
    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!

  8. #498
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,021
    Plugin Contributions
    32

    Default Re: Different shipping methods for different categories

    Hey Linda.. Can you give me a sanity check here por favor???? Am I on the right track here if I use this code???

    Quote Originally Posted by DivaVocals View Post
    Read through this thread (yep ALL 50 pages as of this writing..)

    Wanted to do a sanity check BEFORE I test and implement this.. Does my code for these two different scenarios look correct (restriction based on model number or category ID) Client has yet to decide whether he wants to use model number or category ID, so I will be demoing both options for him..

    Disable based on multiple categories
    Code:
        //Disable based on multiple categories
         // disable only when entire cart is free shipping
          if (zen_get_shipping_enabled($this->code)) {
              $this->enabled = ((MODULE_SHIPPING_FREEOPTIONS_STATUS == 'True') ? true : false);
          }
          // test contents for Cases
           global $cart;
            $skip_free = false;
            $chk_case = 0;
            if (IS_ADMIN_FLAG == false) {
              $chk_case += $_SESSION['cart']->in_cart_check('master_categories_id','56');
              $chk_case += $_SESSION['cart']->in_cart_check('master_categories_id','60');
              if ($chk_case > 0  && ($chk_case != $_SESSION['cart']->count_contents())) {
                $skip_free = true;
              }
            }
    //echo 'FLAT : ' . $chk_case . '<br>';
          // disable for above categories
          if ((IS_ADMIN_FLAG == false && $skip_free)) {
              $this->enabled = false;
          }
    
          if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FREEOPTIONS_ZONE > 0) ) {
    Disable based on multiple model numbers
    Code:
        //Disable based on multiple model numbers
         // disable only when entire cart is free shipping
          if (zen_get_shipping_enabled($this->code)) {
              $this->enabled = ((MODULE_SHIPPING_FREEOPTIONS_STATUS == 'True') ? true : false);
          }
          // test contents for Cases
           global $cart;
            $skip_free = false;
            $chk_case = 0;
            if (IS_ADMIN_FLAG == false) {
              $chk_case += $_SESSION['cart']->in_cart_check('products_model','MH-78523');
              $chk_case += $_SESSION['cart']->in_cart_check('products_model','MH-65489');
              if ($chk_case > 0  && ($chk_case != $_SESSION['cart']->count_contents())) {
                $skip_free = true;
              }
            }
    //echo 'FLAT : ' . $chk_case . '<br>';
          // disable for above model numbers
          if ((IS_ADMIN_FLAG == false && $skip_free)) {
              $this->enabled = false;
          }
    
          if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FREEOPTIONS_ZONE > 0) ) {
    One last thing.. how would I modify this to restrict things based on a specific product ID.. Is it just a matter of doing something like this???:
    Code:
              $chk_case += $_SESSION['cart']->in_cart_check('products_id','23');
              $chk_case += $_SESSION['cart']->in_cart_check('products_id','89');
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

  9. #499

    Default Re: Different shipping methods for different categories

    Quote Originally Posted by Ajeh View Post
    For the test for:
    2. pos_malaysia - enable when cart only have cat #20

    use the test for is the categories_id 20 the only thing in the cart:
    Code:
          $chk_cat = 0;
          $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','20');
          if ($chk_cat > 0  && $chk_cat != $_SESSION['cart']->count_contents()) {
            $this->enabled = false;
          }
    For the test for:
    3. singpost_plus_posmalaysia - mixed cart enable only when cart have cat #20 plus any other cat

    use the test for is this a mixed cart with categories_id 20 in the cart:
    Code:
          $chk_cat = 0;
          $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','20');
          if ($chk_cat > 0  && $chk_cat == $_SESSION['cart']->count_contents()) {
             $this_enabled = false;
          }
    Thank you Linda, I have change to your code and now mixed cart is working fine but when cart with only #20, it show both pos_malaysia and singpost_plus_posmalaysia, it should only show pos_malaysia. And also when cart is without #20, it should only singpost, but right now is show all three.

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

    Default Re: Different shipping methods for different categories

    I have a typo on the mixed cart ...

    This:
    Code:
             $this_enabled = false;
    should be this:
    Code:
             $this->enabled = false;
    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!

 

 
Page 50 of 56 FirstFirst ... 404849505152 ... LastLast

Similar Threads

  1. Re: Different shipping methods for different categories
    By kaddie in forum Built-in Shipping and Payment Modules
    Replies: 14
    Last Post: 19 Nov 2010, 04:37 AM
  2. Replies: 2
    Last Post: 27 Oct 2010, 01:45 PM
  3. Different shipping methods for different categories and mixed categories
    By neit in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 10 Aug 2010, 12:20 AM
  4. Separate Shipping Methods for Different Categories
    By MortalWombat in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 28 Jul 2010, 08:57 AM
  5. Different shipping methods for different product types?
    By talisman-studios in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 17 Sep 2008, 04:59 PM

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