Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2008
    Posts
    63
    Plugin Contributions
    0

    Default Multiple Tare Weights

    Hello,
    I saw a similar question posted in a thread from a couple of years ago, but there was never any resolution to the problem. I'm hoping for a little more success this time.

    I understand tare weights as well as the often misunderstood "larger packages" setting & multiple boxes per shipment.

    As I have it now, the tare weight applies one uniform weight adjustment to all orders. I'm wanting to get a little more sophisticated than that - to get the shipping rates dialed in more accurately.

    Neither the uniform percentage nor the added weight really works in an ideal manner for me.

    What I would like:
    The ability to apply one tare to orders below a certain weight threshold and a different tare to orders above that threshold.

    For example:
    I would like all orders with a weight below 1.5 lbs to get a 3oz tare. All orders above 1.5 lbs should get a 9oz tare.

    (The larger packages setting does not do this.)

    I am not shy about messing around with the code if anyone has any good ideas for this.
    Thanks so much.

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

    Default Re: Multiple Tare Weights

    The Tare is added in the shipping class in the function calculate_boxes_weight_and_tare() ...

    You can alter the amount being used for this calculation in there ...
    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. #3
    Join Date
    Jul 2008
    Posts
    63
    Plugin Contributions
    0

    Default Re: Multiple Tare Weights

    Thank you Ajeh.

    What I came up with is crude, but it works for me.
    If anyone else was interested in this, all I did was hardcode the tare rules into the calculation. After tweaking it for a while, I wanted all orders with a weight less than 1.75 lbs to use a 0.375 lb tare weight. Everything else will get a 0.57 lb tare weight.

    The file we're looking for is: /includes/classes/shipping.php.

    Find code:
    Code:
    switch (true) {
            // large box add padding
            case(SHIPPING_MAX_WEIGHT <= $shipping_weight):
              $shipping_weight = $shipping_weight + ($shipping_weight*($zc_large_percent/100)) + $zc_large_weight;
              break;
            default:
            // add tare weight < large
              $shipping_weight = $shipping_weight + ($shipping_weight*($zc_tare_percent/100)) + $zc_tare_weight;
              break;
          }
    Replace with:
    Code:
    switch (true) {
            // 1st Tare Rule
            case($shipping_weight <= 1.75):
              $shipping_weight = $shipping_weight + 0.375;
              break;
            // All Other Tare Weight
    		default:
              $shipping_weight = $shipping_weight + 0.57;
              break;
          }
    A nice thing about the original code is that it uses the switch statement. If needed you can add more tare weights and rules by copying the first one. Adding more "case" sections can allow for many more rules to be set up.

    Cheers.

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

    Default Re: Multiple Tare Weights

    Thanks for the update that you were able to solve this and for posting the changes that worked for you in order to help others ...
    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!

 

 

Similar Threads

  1. Tare Weights - I am confused
    By janissaire in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 20 Feb 2010, 04:33 AM
  2. Using UPS shipping with variable tare weights
    By JasonDamisch in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 4 Sep 2009, 06:48 AM
  3. Tare Weight 1 pkg multiple issues
    By janissaire in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 3 Sep 2009, 07:42 AM
  4. Help with tare weights
    By isaacr25 in forum Addon Shipping Modules
    Replies: 7
    Last Post: 2 Mar 2008, 10:55 AM
  5. Config Tare Weights
    By jmcdog in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 30 Jun 2006, 06:04 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