Results 1 to 8 of 8
  1. #1
    Join Date
    Nov 2007
    Posts
    71
    Plugin Contributions
    0

    Default Flat rate or similar module to only display when over a certain weight?

    Hello,

    This is driving me crazy, and im sure its more simple than im finding it. I want to setup a shipping module so say for example the total weight is 2kg or more, It will then kick in with that module (or flat rate), but obviously anything under 2kg wont show the module at all?

    I think ive spent too much time with the shipping and for some reason this has got me confused

    Any help would be great
    thank you
    Sam

  2. #2
    Join Date
    Nov 2007
    Posts
    71
    Plugin Contributions
    0

    Default Re: Flat rate or similar module to only display when over a certain weight?

    Or to rephrase it, use weight as a minimum order value instead of price

    Thanks
    Sam

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

    Default Re: Flat rate or similar module to only display when over a certain weight?

    You would need to customize the Flat Rate flat shipping module by cloning it for your heavier orders ...

    Then, you can customize it further to only show when the weight is >= 2 ...

    This can be done by controlling the $this->enabled on the shipping modules and when set to false, they do not show, and when set to true, then the do show ...
    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
    Mar 2008
    Location
    Cape Town & London (depends on the season)
    Posts
    2,975
    Plugin Contributions
    0

    Default Re: Flat rate or similar module to only display when over a certain weight?

    To illustrate Ajeh's point, I have a clone of zonetables shipping module, and modified the code as follows to govern the display of the module (shipping option) based on the weight:-

    Code:
      function zonetable() {
        global $order, $db, $total_weight;
    
        // CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
        $this->num_zones = 6;
    
        $this->code = 'zonetable';
        $this->title = MODULE_SHIPPING_ZONETABLE_TEXT_TITLE;
        $this->description = MODULE_SHIPPING_ZONETABLE_TEXT_DESCRIPTION;
        $this->sort_order = MODULE_SHIPPING_ZONETABLE_SORT_ORDER;
        $this->icon = '';
        $this->tax_class = MODULE_SHIPPING_ZONETABLE_TAX_CLASS;
        $this->tax_basis = MODULE_SHIPPING_ZONETABLE_TAX_BASIS;
        // disable only when entire cart is free shipping
        if (zen_get_shipping_enabled($this->code)) {
          $this->enabled = ((MODULE_SHIPPING_ZONETABLE_STATUS == 'True') ? true : false);
        }
        // Minimum Shipping Weight: If the shipping weight less than 2Kg disable the module
        if ($total_weight < 2) {
          $this->enabled = false;
      	}
    (parts I added are in red).

    PS: a SECOND clone I made (zonetablestwo) reverses the limiter and shows another module when the weight is MORE THAN 2kg.

    Simply reverse:

    Code:
    // Minimum Shipping Weight: If the shipping weight more than 2Kg disable the module
        if ($total_weight > 2) {
          $this->enabled = false;
      	}

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

    Default Re: Flat rate or similar module to only display when over a certain weight?

    Be aware that the $total_weight does not include the Tare Rate ... and you could end up with different results on checkout_shipping ...
    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!

  6. #6
    Join Date
    Mar 2008
    Location
    Cape Town & London (depends on the season)
    Posts
    2,975
    Plugin Contributions
    0

    Default Re: Flat rate or similar module to only display when over a certain weight?

    WELL SPOTTED LINDA!

    Yes... my TARES are set to "null" as my actual product weights factor in the weight value of packaging.

    (By the way... is there a way to INCLUDE tare in my code example?)

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

    Default Re: Flat rate or similar module to only display when over a certain weight?

    The problem is, it knows the total weight plus the tare in the quote of the shipping module, example:
    Code:
      function quote($method = '') {
        global $order, $shipping_weight;
    echo 'QUOTE: ' . $shipping_weight . '<br>';
    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!

  8. #8
    Join Date
    Nov 2007
    Posts
    71
    Plugin Contributions
    0

    Default Re: Flat rate or similar module to only display when over a certain weight?

    thanks guys, will have a bash at this ASAP :)

 

 

Similar Threads

  1. How do I - Flat rate shipping up to a certain weight
    By jjj0923 in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 24 Jan 2012, 12:59 AM
  2. Enable Flat Rate/Disable Zone over certain amount
    By mommyslilmonkey in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 21 May 2010, 08:50 AM
  3. Certain items flat rate only
    By Childproof in forum Built-in Shipping and Payment Modules
    Replies: 5
    Last Post: 28 Mar 2009, 02:42 PM
  4. Disable Flat rate after weight of cart is over a certain amoun
    By brettw in forum Built-in Shipping and Payment Modules
    Replies: 8
    Last Post: 7 Mar 2009, 08:38 PM
  5. Flat Rate / Over $250.00 FREE shipping exclude certain items
    By WebSiteGuru in forum Built-in Shipping and Payment Modules
    Replies: 5
    Last Post: 31 Dec 2008, 04:44 AM

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