Jump to content
Latest News: (loading..)
krdito

Heads Up: July 28, 2013 USPS Name Change for Express Mail

Recommended Posts

USPS changes always seem to cause many problems for online sellers who use the USPS as a shipping option.

 

The upcoming changes planned for July 28, 2013 seem to be just a name change ("Express Mail" will now be called "Priority Express Mail") and possibly, the inclusion of insurance at no additional cost to most "Priority Mail" packages.

 

Here is a link to the announcement:

https://liteblue.usps.gov/news/link/2013/05may/news16s4.htm

 

I am sure the name change will cause major problems for us, just like when Parcel Post was renamed Standard Post : (

Share this post


Link to post
Share on other sites

Once again USPS has crap in their XML output on their testng server they setup for this. XML output is prefaced by

 

27<br>

 

and after the closing XML tag has a

 

<br>0

 

This garbage will have to be removed from the string prior to being passed to your XML parser (ie simplexml_load_string, etc)

Share this post


Link to post
Share on other sites

Appears there is some other garbage in here as well. Also I was mistaken in my prior post - there are not <br> entries. The garbage that does show up all appears to be on its own line, however, they don't use consistent line breaks. Some are /n and some are /r/n. I started working on a little filter to their response but it still has some hiccups:

 

 


$body = implode('',
 array_filter(
   preg_split ('/$\R?^/m', $body), 
   function($check){ 
     return strpos($check,'<') !== false; 
   }
 )
);

Share this post


Link to post
Share on other sites

This filter seems to be working for me. It looks like the "R" regular expression wasn't catching all of their mixed newline instances properly but a basic trim was able to get rid of them. Hope it helps someone else out :)

 

$body_lines = array_filter(
   preg_split ('/$\R?^/m', $body),
   function($check){
       return strpos($check,'<') !== false;
   }
);

array_walk(
   $body_lines,
   function (&$item, $key){
       $item = trim($item);
   }
);

$body = implode('', $body_lines);

Share this post


Link to post
Share on other sites

Well, the changes have, of course, caused major problems.

 

We offer Express Mail, Priority Mail, and Standard Post. The USPS is now only providing shipping costs for Express and Priority Mail for our customers, although there are no service names with the quotes now, just the cost and estimated delivery times for each. There is no quote at all provided for Standard Post, although this service was supposed to have been unaffected by the changes. The additional handling fees that we have added into the USPS shipping module for each service are now not being added into the shipping quote. I have uninstalled and re-installed the shipping module, but the handling fees still aren't being added to the shipping quotes.

 

Any idea on how to fix these issues? Will an entirely new shipping module be required? Oh, and the USPS website is down, so you can't print a label from their site at all.

Share this post


Link to post
Share on other sites

I am having the exact same problems you are having Krdito. The handeling fee is just not been added at all, international just stopped working completly and its not saying the service names in the checkout.

Only thing working for me is the domestic 1st class and priority (with out the handeling fee though) I only use 1st and priority as an option so some others counld posibly have a problem

Why they feel the need to keep changing the names of their servies is beyond me.

Share this post


Link to post
Share on other sites

Rates have stopped working. Express international an priority international are not working.

 

Domestic is returning but the services are not listed.

 

Is anyone working on a free or paid solution? If a developer has a paid solution msg me. I believe I need it for the USPS methods 6.1.

Share this post


Link to post
Share on other sites

I too would gladly pay for a solution! Message me if you can fix the issues I mentioned in my previous post. Thank you!

Share this post


Link to post
Share on other sites

Oh, I and see now that our international shipping quote isn't working at all (we offer Priority and Express Mail international).

Share this post


Link to post
Share on other sites

Attached is a upgraded version of USPS Methods is based on 5.2.1. See http://addons.oscommerce.com/info/487 It is patched and current to 28 July 2013 changes. It works on 2.2, rc2a and 2.3. We've re-tested all options and services and believe they all work.

 

php.gif usps.php 52.26K 25 downloads

 

Please note the server is still set to staging. Go to lines 821-823 to reset to production.

 

You need to upload the file to modules/shipping. You need to uninstall then reinstall in Admin. Don't forget to make note of your settings before you uninstall.

 

Again this is USPS Methods Add On #487


Kym

Projects Director @ ozEworks.com

Share this post


Link to post
Share on other sites

We downloaded the upgraded version referenced above, but then had no ability to edit the settings in the Admin panel.... : (

Edited by krdito

Share this post


Link to post
Share on other sites

We downloaded the upgraded version referenced above, but then had no ability to edit the settings in the Admin panel.... : (

 

 

same here..... :(

Share this post


Link to post
Share on other sites

I'm in the same spot. Dead in the water here. No Standard post and no international options being displayed.

Share this post


Link to post
Share on other sites

What osc version are you all running.

 

I was able to get the above fix and apply it. I was having problems with the USPS options not installing but that was caused due to my general.php file in admin not having the correct function for multi select. I think tep_cfg_multi*

 

Once I added that it is working - the handling cost do not work - but I was able to hardcode the handling cost...

Share this post


Link to post
Share on other sites

What osc version are you all running.

 

I was able to get the above fix and apply it. I was having problems with the USPS options not installing but that was caused due to my general.php file in admin not having the correct function for multi select. I think tep_cfg_multi*

 

Once I added that it is working - the handling cost do not work - but I was able to hardcode the handling cost...

 

 

I have 2.2. I have USPS methods 6.0 installed. When I add the updated USPS fileand then re-install USPS methods and click edit I get nothing. Can you be more specific about the general.php file?

 

Thanks,

Mike

Share this post


Link to post
Share on other sites

It looks to me like the general.php changes he is talking about is not included in the usps methods v6.1x but is in the usps methods v5.2.x.. it involves adding functions by GREG DEETH to both /admin/includes/functions/general.php and to /includes/functions/general.php

 

I am unsure if this code is needed in the usps methods v6.1x or not.. I know that last year's upgrade had me REMOVING this code which had been there since the dawn of time!

 

10.  If this is a new install or an upgrade from stock or old version, then make the following modifications.  If not, then skip to step 13.

catalog/admin/includes/functions/general.php

Find somewhere around line 767:

////
// Alias function for module configuration keys
 function tep_mod_select_option($select_array, $key_name, $key_value) {
   reset($select_array);
   while (list($key, $value) = each($select_array)) {
     if (is_int($key)) $key = $value;
     $string .= '<br><input type="radio" name="configuration[' . $key_name . ']" value="' . $key . '"';
     if ($key_value == $key) $string .= ' CHECKED';
     $string .= '> ' . $value;
   }

   return $string;
 }

Insert After

// Alias function for Store configuration values in the Administration Tool
 function tep_cfg_select_multioption($select_array, $key_value, $key = '') {
   for ($i=0; $i<sizeof($select_array); $i++) {
       $search = array(' regimark', ' tradmrk');
       $replace = array('<sup>®</sup>', '<sup>™</sup>');
     $name = (($key) ? 'configuration[' . $key . '][]' : 'configuration_value');
     $string .= '<br><input type="checkbox" name="' . $name . '" value="' . $select_array[$i] . '"';
     $key_values = explode( ", ", $key_value);
     if ( in_array($select_array[$i], $key_values)) $string .= ' CHECKED';
     $string .= '> ' . str_replace($search, $replace,$select_array[$i]);
   }
   $string .= '<input type="hidden" name="' . $name . '" value="--none--">';
   return $string;
 }

// USPS Methods.  Added by Greg Deeth
// Alias function for Store configuration values in the Administration Tool.
 function tep_cfg_multiinput_list($select_array, $key_value, $key = '') {
   $key_values = explode( ", ", $key_value);

   for ($i=0; $i<sizeof($select_array); $i++) {
     $name = (($key) ? 'configuration[' . $key . '][]' : 'configuration_value');
     $string .= '<br><input type="text" name="' . $name . '" value="' . $key_values[$i] . '"> ' . $select_array[$i];
   }
   $string .= '<input type="hidden" name="' . $name . '" value="--none--">';
   return $string;
 }

// USPS Methods.  Added by Greg Deeth
// Alias function for Store configuration values in the Administration Tool.
 function tep_cfg_multiinput_duallist_oz($select_array, $key_value, $key = '') {
   $key_values = explode( ", ", $key_value);
   $string .= '<center>';

   for ($i=0; $i<sizeof($select_array); $i++) {
           $current_key_value = current($key_values);

     $name = (($key) ? 'configuration[' . $key . '][]' : 'configuration_value');
     $string .= '<br><input type="text" name="' . $name . '" size="3" value="' . $current_key_value . '"><i>oz</i>';
           $string .= ' <b><</b> ' . $select_array[$i] . ' <u><b><</b></u>';
           next($key_values);
           $current_key_value = current($key_values);
           $string .= '<input type="text" name="' . $name . '" size="3" value="' . $current_key_value . '"><i>oz</i>';
           next($key_values);
   }
   $string .= '<input type="hidden" name="' . $name . '" value="--none--">';

   $string .= '</center>';
   return $string;
 }
 function tep_cfg_multiinput_duallist_lb($select_array, $key_value, $key = '') {
   $key_values = explode( ", ", $key_value);
   $string .= '<center>';

   for ($i=0; $i<sizeof($select_array); $i++) {
           $current_key_value = current($key_values);

     $name = (($key) ? 'configuration[' . $key . '][]' : 'configuration_value');
     $string .= '<br><input type="text" name="' . $name . '" size="3" value="' . $current_key_value . '"><i>lbs</i>';
           $string .= ' <b><</b> ' . $select_array[$i] . ' <u><b><</b></u>';
           next($key_values);
           $current_key_value = current($key_values);
           $string .= '<input type="text" name="' . $name . '" size="3" value="' . $current_key_value . '"><i>lbs</i>';
           next($key_values);
   }
   $string .= '<input type="hidden" name="' . $name . '" value="--none--">';

   $string .= '</center>';
   return $string;
 }

11.  Add the following:

catalog/includes/functions/general.php

Find somewhere around line 287:

////
// Wrapper function for round()
 function tep_round($number, $precision) {
   if (strpos($number, '.') && (strlen(substr($number, strpos($number, '.')+1)) > $precision)) {
     $number = substr($number, 0, strpos($number, '.') + 1 + $precision + 1);

     if (substr($number, -1) >= 5) {
       if ($precision > 1) {
         $number = substr($number, 0, -1) + ('0.' . str_repeat(0, $precision-1) . '1');
       } elseif ($precision == 1) {
         $number = substr($number, 0, -1) + 0.1;
       } else {
         $number = substr($number, 0, -1) + 1;
       }
     } else {
       $number = substr($number, 0, -1);
     }
   }

   return $number;
 }

Insert After:

////
// Round up function for non whole numbers by GREG DEETH
// The value for the precision variable determines how many digits after the decimal and rounds the last digit up to the next value
// Precision = 0 -> xx.xxxx = x+
// Precision = 1 -> xx.xxxx = xx.+
// Precision = 2 -> xx.xxxx = xx.x+
 function tep_round_up($number, $precision) {
           $number_whole = '';
           $num_left_dec = 0;
           $num_right_dec = 0;
           $num_digits = strlen($number);
           $number_out = '';
           $i = 0;
           while ($i + 1 <= strlen($number))
           {
                       $current_digit = substr($number, $i, ($i + 1) - $num_digits);
                       if ($current_digit == '.') {
                                   $i = $num_digits + 1;
                                   $num_left_dec = strlen($number_whole);
                                   $num_right_dec = ($num_left_dec + 1) - $num_digits;
                       } else {
                                   $number_whole = $number_whole . $current_digit;
                                   $i = $i + 1;
                       }
           }
           if ($num_digits > 3 && $precision < ($num_digits - $num_left_dec - 1) && $precision >= 0) {
                       $i = $precision;
                       $addable = 1;
                       while ($i > 0) {
                                   $addable = $addable * .1;
                                   $i = $i - 1;
                       }
                       $number_out = substr($number, 0, $num_right_dec + $precision) + $addable;
           } else {
                       $number_out = $number;
           }
           return $number_out;
 }


Debbie D
Franklin County, VA "Moonshine Capitol of the World"
osCmax Mobile Template oscmaxtemplates.com

Share this post


Link to post
Share on other sites

What osc version are you all running.

 

I was able to get the above fix and apply it. I was having problems with the USPS options not installing but that was caused due to my general.php file in admin not having the correct function for multi select. I think tep_cfg_multi*

 

Once I added that it is working - the handling cost do not work - but I was able to hardcode the handling cost...

 

Can you share what you did to hardcode the handling cost? I have the general.php issue fixed but the handling cost is not being added to the shipping cost. Thanks.

Share this post


Link to post
Share on other sites

Attached is a upgraded version of USPS Methods is based on 5.2.1. See http://addons.oscommerce.com/info/487 It is patched and current to 28 July 2013 changes. It works on 2.2, rc2a and 2.3. We've re-tested all options and services and believe they all work.

 

php.gif usps.php 52.26K 25 downloads

 

Please note the server is still set to staging. Go to lines 821-823 to reset to production.

 

You need to upload the file to modules/shipping. You need to uninstall then reinstall in Admin. Don't forget to make note of your settings before you uninstall.

 

Again this is USPS Methods Add On #487

 

It appears that this updated code is lacking First-Class Mail Parcel....... could you assist in getting that put back in?

Thanks!

Share this post


Link to post
Share on other sites

Can you share what you did to hardcode the handling cost? I have the general.php issue fixed but the handling cost is not being added to the shipping cost. Thanks.

 

I'm not sure what jshroff did. However, as a quick fix that works for me, I added the following around line line 970 (just after the MODULE_SHIPPING_USPS_DMST_SIG_CONF section) in the USPS.php file:

 

$handlingfactor = 1.05;

$postage = $postage * $handlingfactor;

 

It adds 5% to the USPS cost. I only ship via Priority Mail and, therefore, do not have to contend with different handling fees for different shipping types.

 

I would be interested to see how others are treating the handling charge.

Share this post


Link to post
Share on other sites

I'm having a hard time getting anything to work now. I've installed this addon: http://addons.oscommerce.com/info/487 And, now on the shipping page, all I get is this error:An error occured with the USPS shipping calculations.

If you would like to use USPS as your shipping method, please contact the store owner.

Share this post


Link to post
Share on other sites

Well, I got this to work. But, now it doesn't display the shipping methods -- just the transit time. Where would I go to put the names back in?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×