View Single Post
  #79  
Old 04-12-2012, 09:59 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,201
 

Default Re: X-Cart v4.4.5 released

USPS bug in 4.4.5, it may be present in other versions as well. It may be due to resent USPS changes though. Apparently USPS requires "girth" to be passed with each request and it cannot be 0. XC has a field for girth in USPS settings in admin and it defaults to 0. It is not possible to enter correct number there until package dimensions are known. Width, length and height are also 0 by default but XC calculates them if they are not specified or 0 to USPS standards. XC does not caluculates girth (at least in 4.4.5) and just passes whatever is specified in admin USPS settings and if it is 0 USPS returns error instead of rates.

How to fix:

1. In shipping/mod_USPS.php find

Code:
$dim_girth_xml = "<Girth>".func_units_convert(func_dim_in_centimeters(@$specified_dims['girth']), 'cm', 'in', 1)."</Girth>";

and just before it add

Code:
// added by CFL Systems to calculate girth if 0 $new_box = array ( 'length' => $pack['length'], 'width' => $pack['width'], 'height' => $pack['height'] ); $specified_dims['girth'] = ($specified_dims['girth'] > 0) ? $specified_dims['girth'] : func_girth($new_box); // added by CFL Systems to calculate girth if 0

OR if you don't want to modify php files

2. Just enter a number > 0 in the girth field in admin USPS settings
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote