Page 1 of 2 12 LastLast
Results 1 to 10 of 21

Hybrid View

  1. #1
    Join Date
    Jan 2008
    Location
    Essex, MA
    Posts
    41
    Plugin Contributions
    0

    Default Re: USPS Rounding Errors -- Should never round down

    Anybody...?

  2. #2
    Join Date
    Jan 2008
    Location
    Essex, MA
    Posts
    41
    Plugin Contributions
    0

    Default Re: USPS Rounding Errors -- Should never round down

    So no admins actually care that the USPS Shipping Module simply does NOT function correctly? Say it ain't so.....

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

    Default Re: USPS Rounding Errors -- Should never round down

    Google says ...
    0.482 pounds = 7.71200 ounces

    0.452 pounds = 7.23200 ounces

    Could you also post your Ship From and Ship To so we are comparing apples and apples?
    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!

  4. #4
    Join Date
    Jan 2008
    Location
    Essex, MA
    Posts
    41
    Plugin Contributions
    0

    Default Re: USPS Rounding Errors -- Should never round down

    Ajeh, you're right about what Google says, 0.452 lbs is 7.232 ounces... a typo in my post, but it doesn't actually change anything. It's over 7 ounces, therefore USPS will automatically charge you at the 8-ounce rate, which for 1st Class Mail would be $2.41. And it's still apples to apples since USPS First Class Mail isn't determines by zip code.

    So you see, it shouldn't matter whether my package weighs 7.712 or 7.232 ounces, either way ZC should calculate the shipping charge based on 8-ounces. Unfortunately, this doesn't appear to be what's happening.

    Instead, it assigns the correct $2.41 charge to the package weighing 7.781, which I assume is because, simply enough, the routine correctly rounded up to 8.000. But then ZC only assigns a $2.24 charge (the USPS 7-ounce rate) to the package weighing 7.232, even though the USPS requires that I ship it at the 8-ounce rate. Here I suspect it's just a matter of the Shipping Module rounding down from 7.232 when in fact it should still round up to 8.000 as well.

    If it were up to me and I knew where exactly I could tweak the code, I'd make it so the module would round up for anything that's, say, 0.050 over the full-ounce mark.


    Did that all make sense?
    Last edited by TraderDan; 11 Jul 2009 at 05:54 AM.

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

    Default Re: USPS Rounding Errors -- Should never round down

    Look in the usps.php shipping module and tweak the calculation on the pounds and ounces to the way you want it to work ...

    We will look further into this for a future release ...
    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!

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

    Default Re: USPS Rounding Errors -- Should never round down

    Edit your usps.php shipping module and change:
    Code:
        $shipping_ounces = round(16 * ($usps_shipping_weight - floor($usps_shipping_weight)));
    to read:
    Code:
        $shipping_ounces = (16 * ($usps_shipping_weight - floor($usps_shipping_weight)));
    Do you get more accurate rates now?
    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!

  7. #7
    Join Date
    Jan 2008
    Location
    Essex, MA
    Posts
    41
    Plugin Contributions
    0

    Default Re: USPS Rounding Errors -- Should never round down

    Ajeh-

    Thanks for taking the time to help. It's been a while since my initial posting (cra-zee busy these days), but I have just implemented the suggested change and will let you know.

    And since we're on the topic of the USPS shipping module, I have another related question... why is ZC insisting that a 1-ounce package shipped to Canada cost $20 USPS Priority International?!

    I have both First-Class Mail International and Priority Mail International enabled in my module, but even for a 1-ounce package it is coming up with a $20 Priority charge ONLY. Any insight would be greatly appreciated... again.

    Thanks in advance,
    -Dan

  8. #8
    Join Date
    Jan 2008
    Location
    Essex, MA
    Posts
    41
    Plugin Contributions
    0

    Default Re: USPS Rounding Errors -- Should never round down

    Quote Originally Posted by Ajeh View Post
    Edit your usps.php shipping module and change:
    Code:
        $shipping_ounces = round(16 * ($usps_shipping_weight - floor($usps_shipping_weight)));
    to read:
    Code:
        $shipping_ounces = (16 * ($usps_shipping_weight - floor($usps_shipping_weight)));
    Do you get more accurate rates now?
    Unfortunately, this does not fix the problem, it only makes it worse actually. After observing the differences, it's clear that the suggested edit above causes everything to round down. For example, I just had a package that weighs 6.7 ounces and ZC now decided to charge for only 6 ounces, which means I'm losing money. When I changed it back though, it properly calculated the shipping for 7 ounces.

    So yeah, there's still some real issues going on here with the USPS module... hoping these can get resolved for a future release.

  9. #9
    Join Date
    Dec 2008
    Posts
    3
    Plugin Contributions
    0

    Default Re: USPS Rounding Errors -- Should never round down

    So no admins actually care that the USPS Shipping Module simply does NOT function correctly? Say it ain't so.....

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

    Default Re: USPS Rounding Errors -- Should never round down

    TraderDan, that is still not the right file ...

    If you edit the file, you will see it contains on line 3:
    * USPS Module for Zen Cart v1.3.x, revised May 12, 2008 for new USPS rates effective May 12, 2008
    And that the ID on line 9 is:
    * @version $Id: usps.php 8516 2008-05-13 01:56:07Z drbyte $
    Get the USPS May 12 2008 download and load it to the directory:
    /includes/modules/shipping

    If you then search it and get the wrong date, delete the file on the server ... and then load it ...
    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 1 of 2 12 LastLast

Similar Threads

  1. v153 Admin rounding errors
    By strelitzia in forum Bug Reports
    Replies: 10
    Last Post: 6 Sep 2017, 09:13 AM
  2. Round errors when calculating prices
    By dr_james_leo in forum General Questions
    Replies: 2
    Last Post: 18 Nov 2011, 11:00 AM
  3. USPS never errors on bad zip
    By split63 in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 1 Jul 2010, 08:58 AM
  4. Rounding up and rounding down how to stop this?
    By Kazz in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 9
    Last Post: 24 Jul 2008, 06:40 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