Please help us to make AbanteCart Ideal Open Source Ecommerce Solution for everyone.

Support AbanteCart eCommerce

Author Topic: USPS Girth Calculation  (Read 9263 times)

Offline CalSci

  • Newbie
  • *
  • Posts: 6
  • Karma: +2/-0
    • View Profile
USPS Girth Calculation
« on: May 02, 2019, 06:35:09 AM »
In the file:
cart slash extensions slash default_usps slash storefront slash model slash extension slash default_usps.php

The following line is incorrect:

         // Calculate girth based on usps calculation
         $xml .= '      <Girth>' . (round(((float)$this->config->get('default_usps_length') + (float)$this->config->get('default_usps_width') * 2 + (float)$this->config->get('default_usps_height') * 2), 1)) . '</Girth>';

Girth is 2*width+2*height. USPS does use length+girth often, but that is not the same thing. Also that formula only works if length is longer than width and height, otherwise it needs to sort the longest side out of the formula.
« Last Edit: May 02, 2019, 06:42:04 AM by CalSci »

Offline Basara

  • Administrator
  • Hero Member
  • *****
  • Posts: 5772
  • Karma: +274/-2
    • View Profile

Offline Basara

  • Administrator
  • Hero Member
  • *****
  • Posts: 5772
  • Karma: +274/-2
    • View Profile
Re: USPS Girth Calculation
« Reply #2 on: May 02, 2019, 06:52:47 AM »
Girth is 2*width+2*height. USPS does use length+girth often, but that is not the same thing. Also that formula only works if length is longer than width and height, otherwise it needs to sort the longest side out of the formula.

Do you have any link to USPS manuals to verify that USPS calculate in your approach?

Offline Basara

  • Administrator
  • Hero Member
  • *****
  • Posts: 5772
  • Karma: +274/-2
    • View Profile
Re: USPS Girth Calculation
« Reply #3 on: May 02, 2019, 07:15:54 AM »
Hi.
Here is what I found
https://pe.usps.com/text/qsg300/q201e.htm
Quote
Except for USPS Retail Ground and Parcel Select, no mailpiece may measure more than 108 inches in length and girth combined.

Offline CalSci

  • Newbie
  • *
  • Posts: 6
  • Karma: +2/-0
    • View Profile
Re: USPS Girth Calculation
« Reply #4 on: May 03, 2019, 12:27:15 AM »
Yes, that is correct, USPS has limitations on length+girth. Girth = 2*width+2*height, assuming that length is the longest side. Girth+length = length+2*width+2*height. Girth itself does not include length in it.

Offline aricjoshua

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: USPS Girth Calculation
« Reply #5 on: September 16, 2021, 10:43:04 AM »
This is a recipe that I recently came across. USPS has a limit on length + circumference is a correct formula, hopefully, it will be useful for future problems.

 

Powered by SMFPacks Social Login Mod