Results 1 to 8 of 8
  1. #1
    Join Date
    Jan 2007
    Location
    UK
    Posts
    55
    Plugin Contributions
    0

    Default Remove a shipping method based on value

    I am currently using ZC 1.3.7 and have 3 methods of shipping - flat rate, next day and overseas.

    Is it possible to remove one of the options from the customers choice (the flat rate) if the order is above a certain value.
    ie to just offer next day and overseas.

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    64,717
    Plugin Contributions
    6

    Default Re: Remove a shipping method based on value

    Edit the Flat Rate flat shipping module and change:
    Code:
          // disable only when entire cart is free shipping
          if (zen_get_shipping_enabled($this->code)) {
            $this->enabled = ((MODULE_SHIPPING_FLAT_STATUS == 'True') ? true : false);
          }
    to read:
    Code:
          // disable only when entire cart is free shipping
          if (zen_get_shipping_enabled($this->code)) {
            $this->enabled = ((MODULE_SHIPPING_FLAT_STATUS == 'True') ? true : false);
          }
    
          global $cart;
          if (IS_ADMIN_FLAG == false && $_SESSION['cart']->show_total() >= 75.00) {
            $this->enabled = false;
          }
    where 75.00 is the amount to turn off the shipping module at ...

    The IS_ADMIN_FLAG is used so that the module works on the Admin ...
    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.1]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...

  3. #3
    Join Date
    Jan 2007
    Location
    UK
    Posts
    55
    Plugin Contributions
    0

    Default Re: Remove a shipping method based on value

    Thank you Linda, that worked perfectly.

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    64,717
    Plugin Contributions
    6

    Default Re: Remove a shipping method based on value

    Thanks for the update that this worked for you ...
    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.1]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...

  5. #5
    Join Date
    Nov 2006
    Posts
    24
    Plugin Contributions
    0

    Default Re: Remove a shipping method based on value

    You can also disable the flat rate based on weight. Suppose you want to disable flat rate shipping on orders over 5 lbs.

    You need to edit
    /includes/modules/shipping/flat.php

    You would insert this code just below the code that disables the module if entire cart is free shipping.

    Code:
    // disable if the weight is over 5lbs
    global $cart;
    $shipWeight = $_SESSION['cart']->show_weight();
    if (IS_ADMIN_FLAG == false && $shipWeight >= 5.00) {
    	$this->enabled = false;
    }
    It's too bad these modules cannot be changed via overrides. Or can they?

  6. #6
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    64,717
    Plugin Contributions
    6

    Default Re: Remove a shipping method based on value

    There are not overrides for the shipping modules but you can always clone a shipping module ...

    NOTE: be sure to test new shipping modules or changes in both the Catalog and Admin to ensure that they run properly ...
    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.1]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...

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

    Default Re: Remove a shipping method based on value

    and what is the code if I would disable the modules with weight < 5 and total > 50 ?

  8. #8
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    64,717
    Plugin Contributions
    6

    Default Re: Remove a shipping method based on value

    Code:
    global $cart;
    $shipWeight = $_SESSION['cart']->show_weight();
    $shipTotal = $_SESSION['cart']->show_total();
    if (IS_ADMIN_FLAG == false && ($shipWeight < 5.00 and $shipTotal > 50) {
    	$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: v1.5.1]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...

 

 

Similar Threads

  1. Fastway Courier, PostCode based shipping method
    By FredZ in forum Addon Shipping Modules
    Replies: 41
    Last Post: 24 Apr 2012, 05:24 AM
  2. Payment based on shipping method?
    By Jeff G in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 23 Nov 2008, 10:48 PM
  3. Set flat rates based on UPS shipping method?
    By 3hounddesign in forum Built-in Shipping and Payment Modules
    Replies: 5
    Last Post: 23 Oct 2007, 10:34 AM
  4. Shipping based on zone, weight and method
    By ernmeg in forum Built-in Shipping and Payment Modules
    Replies: 4
    Last Post: 7 May 2007, 04:56 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
  •