Guest jeromas Posted October 12, 2005 Share Posted October 12, 2005 Don't know if people are having trouble with the USPS module not providing ounces (I'm still using 3.0.3), but it is an issue in 3.0.3. To fix the problem, you'll need to open calc.php under /modules/USPS/calc.php and add/change the following lines: After this code (around line 78 or so): // only proceed if module is enabled if($module["service_".$moduleKey]==1){ Add these lines: list($totalWeight,$ounces) = split("\.",$totalWeight,2); $ounces = round(($ounces * 10) / 16,0); The added lines come before this code (line 83 or so): switch($moduleKey) { Now you need to change a couple of things: In the switch statement found around lines 83-201, you'll see code like this for each of the different types of USPS shipping: case "Express": $package = array( 'zip_origin' => $module['zip_origin'], 'zip_dest' => $zip_dest, 'pounds' => $totalWeight, 'ounces' => '0', 'service' => 'EXPRESS', 'size' => $module['expressSize'], 'container' => $module['expressContainer'], 'country' => $countryName, 'mail_type' => "Package" ); For EACH type of shipping (Express, Priority, etc), you need to change the following line in the switch statement: Change 'ounces'=> '0', to the following: 'ounces'=> $ounces, So now the code will look like this: case "Express": $package = array( 'zip_origin' => $module['zip_origin'], 'zip_dest' => $zip_dest, 'pounds' => $totalWeight, 'ounces' => $ounces, 'service' => 'EXPRESS', 'size' => $module['expressSize'], 'container' => $module['expressContainer'], 'country' => $countryName, 'mail_type' => "Package" ); This will result in changing 8 lines of code. Any more or any less, and you missed something somewhere. Save the file, upload it, and try your USPS shipping. It worked for me after I made this fix. Quote Link to comment Share on other sites More sharing options...
djcaseanova Posted January 23, 2006 Share Posted January 23, 2006 Is 3.0.8 already setup like this or does this still need to be updated? For product weight it still says "LBS" Quote Link to comment Share on other sites More sharing options...
Guest Posted January 24, 2006 Share Posted January 24, 2006 list($totalWeight,$ounces) = split("\.",$totalWeight,2); $ounces = round(($ounces * 10) / 16,0); That will work, but the all the new versions do this already and quite accurately I might add. This is the code used. It's simpler to read and more efficient. $lbs = floor($totalWeight); $oz = ceil(($totalWeight - $lbs) * 16); And no, djcaseanova, all 3.0.6 and up all have the updated USPS code in them......I should know....I wrote it. :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.