Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

USPS PROBLEMS ANYONE? HERE IS THE FIX!


sammedit

Recommended Posts

I run three oscommerce sites but I didn't find out until today that the USPS module wasn't working on any of them! So I poked around on the forums to try and find some answers. Here is what fixed two of my sites....

First off...Run the update.sql below.

 

UPDATE configuration

SET configuration_value = UPPER(configuration_value),

set_function='tep_cfg_select_multioption(array(''GLOBAL EXPRESS'', ''GLOBAL EXPRESS NON-DOC RECT'', ''GLOBAL EXPRESS NON-DOC NON-RECT'', ''EXPRESS MAIL INT'', ''EXPRESS MAIL INT FLAT RATE ENV'', ''PRIORITY MAIL INT'', ''PRIORITY MAIL INT FLAT RATE ENV'', ''PRIORITY MAIL INT FLAT RATE BOX'', ''FIRST-CLASS MAIL INT''), '

WHERE configuration_key='MODULE_SHIPPING_USPS_TYPES_INTL';

 

UPDATE configuration

SET configuration_value = UPPER(configuration_value),

set_function='tep_cfg_select_multioption(array(''EXPRESS'', ''PRIORITY'', ''FIRST CLASS'', ''PARCEL'', ''BPM'', ''LIBRARY'', ''MEDIA''), '

WHERE configuration_key='MODULE_SHIPPING_USPS_TYPES'

 

 

Then go into includes/modules/shipping/usps.php and around line 45 make all of your shipping options uppercase like below:

 

$this->types = array('EXPRESS' => 'Express Mail',

'FIRST CLASS' => 'First-Class Mail',

'PRIORITY' => 'Priority Mail',

'PARCEL' => 'Parcel Post');

 

$this->intl_types = array('GXG DOCUMENT' => 'Global Express Guaranteed Document Service',

'GXG NON-DOCUMENT' => 'Global Express Guaranteed Non-Document Service',

'EXPRESS' => 'Global Express Mail (EMS)',

'PRIORITY LG' => 'Global Priority Mail - Flat-rate Envelope (large)',

'PRIORITY SM' => 'Global Priority Mail - Flat-rate Envelope (small)',

'PRIORITY VAR' => 'Global Priority Mail - Variable Weight Envelope (single)',

'AIRMAIL LETTER' => 'Airmail Letter Post',

'AIRMAIL PARCEL' => 'Airmail Parcel Post',

'SURFACE LETTER' => 'Economy (Surface) Letter Post',

'SURFACE POST' => 'Economy (Surface) Parcel Post');

 

THAT FIXED TWO OUT OF THE THREE SITES. NOW ON THE THIRD SITE I TRIED THIS AND IT DID NOT WORK. THE USPS.PHP WAS DIFFERENT ON THIS SITE AND LOOKED MORE LIKE:

 

$this->types = array('EXPRESS' => 'EXPRESS', 'FIRST CLASS' => 'First-Class Mail', 'PRIORITY' => 'PRIORITY', 'PARCEL' => 'Parcel', 'BPM' => 'Bound Printed Material', 'LIBRARY' => 'Library', 'MEDIA' => 'Media Mail');

 

$this->intl_types = array('GLOBAL EXPRESS' => 'Global Express Guaranteed',

'GLOBAL EXPRESS NON-DOC RECT' => 'Global Express Guaranteed Non-Document Rectangular',

'GLOBAL EXPRESS NON-DOC NON-RECT' => 'Global Express Guaranteed Non-Document Non-Rectangular',

'EXPRESS MAIL INT' => 'Express Mail International (EMS)',

'EXPRESS MAIL INT FLAT RATE ENV' => 'Express Mail International (EMS) Flat Rate Envelope',

'PRIORITY MAIL INT' => 'Priority Mail International',

'PRIORITY MAIL INT FLAT RATE ENV' => 'Priority Mail International Flat Rate Envelope',

'PRIORITY MAIL INT FLAT RATE BOX' => 'Priority Mail International Flat Rate Box',

'FIRST-CLASS MAIL INT' => 'First-Class Mail International');

 

SO WHAT I DID WAS RUN THE SQL, THEN COPY AND PASTE THE USPS.PHP FROM THE OTHER SITES TO THIS SITE AND IT WORKED. SO IF YOUR CODE LOOKS LIKE THE CODE ABOVE, TRY CHANGING IT TO:

 

$this->types = array('EXPRESS' => 'Express Mail',

'FIRST CLASS' => 'First-Class Mail',

'PRIORITY' => 'Priority Mail',

'PARCEL' => 'Parcel Post');

 

$this->intl_types = array('GXG DOCUMENT' => 'Global Express Guaranteed Document Service',

'GXG NON-DOCUMENT' => 'Global Express Guaranteed Non-Document Service',

'EXPRESS' => 'Global Express Mail (EMS)',

'PRIORITY LG' => 'Global Priority Mail - Flat-rate Envelope (large)',

'PRIORITY SM' => 'Global Priority Mail - Flat-rate Envelope (small)',

'PRIORITY VAR' => 'Global Priority Mail - Variable Weight Envelope (single)',

'AIRMAIL LETTER' => 'Airmail Letter Post',

'AIRMAIL PARCEL' => 'Airmail Parcel Post',

'SURFACE LETTER' => 'Economy (Surface) Letter Post',

'SURFACE POST' => 'Economy (Surface) Parcel Post');

 

AND THAT SHOULD DO THE TRICK. IF IT DOES NOT WORK, THE PROBLEM IS SOMEWHERE ELSE IN THE USPS.PHP FILE AND I WILL POST THE ENTIRE WORKING FILE ON HERE ASAP. THANK ALL OF YOU PEOPLE WHO HAVE MADE MY OSC EXPERIENCE SO MUCH EASIER AND BETTER BY POSTING CONTRIBUTIONS AND FIXES. I COULDN'T HAVE DONE IT WITHOUT YOU GUYS!!!

 

NOTE: THIS IS WHAT WORKED FOR ME. IT IS A BASIC FUNCTIONAL SHIPPING MODULE. I DO NOT USE INSURANCE OR ANYTHING ELSE ON MY MODULES. JUST EXPRESS, PRIORITY, AND PARCEL. AND EVERYTHING THAT I USE SEEMS TO BE WORKING WITH THESE CHANGES.

Link to comment
Share on other sites

SO IF YOUR CODE LOOKS LIKE THE CODE ABOVE, TRY CHANGING IT TO:

 

$this->types = array('EXPRESS' => 'Express Mail',

'FIRST CLASS' => 'First-Class Mail',

'PRIORITY' => 'Priority Mail',

'PARCEL' => 'Parcel Post');

 

$this->intl_types = array('GXG DOCUMENT' => 'Global Express Guaranteed Document Service',

'GXG NON-DOCUMENT' => 'Global Express Guaranteed Non-Document Service',

'EXPRESS' => 'Global Express Mail (EMS)',

'PRIORITY LG' => 'Global Priority Mail - Flat-rate Envelope (large)',

'PRIORITY SM' => 'Global Priority Mail - Flat-rate Envelope (small)',

'PRIORITY VAR' => 'Global Priority Mail - Variable Weight Envelope (single)',

'AIRMAIL LETTER' => 'Airmail Letter Post',

'AIRMAIL PARCEL' => 'Airmail Parcel Post',

'SURFACE LETTER' => 'Economy (Surface) Letter Post',

'SURFACE POST' => 'Economy (Surface) Parcel Post');

 

Thanks for your work - BUT THIS IS NOT THE RIGHT FIX. Among other things the above changes (don't know whether you were being sloppy or what) include defunct international mail categories.

 

As noted on other threads the simple fix, IF YOU HAVE A MODULE THAT WAS UP TO DATE UNTIL AROUND A WEEK AGO, requires only that you ensure that the "keys" are sent as capital letters. I'm not sure anyone knows at this moment exactly what the USPS did (much less why they did it), but in any event for the moment that seems to solve the problem. And even if they go back to a case-insensitive set-up, it won't hurt to have your keys in all-caps.

 

I hope.

 

Big note:

 

If you just modify the keys to uppercase, you'll have to uninstall and reinstall your module to make sure the changes take effect. If you run the sql update, then I don't think you have to do it. I confess I'm not 100% clear on why the usps.php file is written the way that it is, but things seemed to work fine when I did both - uninstall and re-install, also just update the file and run the sql update. However, as others have noted, if you go the "quick" route and just modify to uppercase and re-install, be sure to locate or to copy your USPS userid, password, and module settings (at your admin modules page) before you remove the shipping module, since, when you reinstall it, you'll have to provide the info again.

 

Here's the fix for updated USPS modules:

 

My recommendation: go to http://addons.oscommerce.com/info/487 for working, updated modules and instructions. If you've performed custom alterations to your usps.php module, you'll have to do a file compare, and maybe strain your eyes and scratch your head a little.

 

As for the "newbie" question: It shouldn't really make much difference whether you run a sql update before or after changing the php file, as long as you do both. Not sure why you were getting the error you mentioned, but if you're running phpmyadmin, you should be able to find your store database (you may have more than one database set up on your server, I don't know), probably named something like "youruserid_p_os2 (63)" - click on it, then either click import if you're using a sql update file as in the contribution at the link directly above, or go to SQL and paste in the update info if you're just cutting and pasting.

 

If you go to the contribution link, and follow the instructions, it should work.

Edited by kymar
Link to comment
Share on other sites

Thanks for your work - BUT THIS IS NOT THE RIGHT FIX. Among other things the above changes (don't know whether you were being sloppy or what) include defunct international mail categories.

 

As noted on other threads the simple fix, IF YOU HAVE A MODULE THAT WAS UP TO DATE UNTIL AROUND A WEEK AGO, requires only that you ensure that the "keys" are sent as capital letters. I'm not sure anyone knows at this moment exactly what the USPS did (much less why they did it), but in any event for the moment that seems to solve the problem. And even if they go back to a case-insensitive set-up, it won't hurt to have your keys in all-caps.

 

I hope.

 

Big note:

 

If you just modify the keys to uppercase, you'll have to uninstall and reinstall your module to make sure the changes take effect. If you run the sql update, then I don't think you have to do it. I confess I'm not 100% clear on why the usps.php file is written the way that it is, but things seemed to work fine when I did both - uninstall and re-install, also just update the file and run the sql update. However, as others have noted, if you go the "quick" route and just modify to uppercase and re-install, be sure to locate or to copy your USPS userid, password, and module settings (at your admin modules page) before you remove the shipping module, since, when you reinstall it, you'll have to provide the info again.

 

Here's the fix for updated USPS modules:

 

My recommendation: go to http://addons.oscommerce.com/info/487 for working, updated modules and instructions. If you've performed custom alterations to your usps.php module, you'll have to do a file compare, and maybe strain your eyes and scratch your head a little.

 

As for the "newbie" question: It shouldn't really make much difference whether you run a sql update before or after changing the php file, as long as you do both. Not sure why you were getting the error you mentioned, but if you're running phpmyadmin, you should be able to find your store database (you may have more than one database set up on your server, I don't know), probably named something like "youruserid_p_os2 (63)" - click on it, then either click import if you're using a sql update file as in the contribution at the link directly above, or go to SQL and paste in the update info if you're just cutting and pasting.

 

If you go to the contribution link, and follow the instructions, it should work.

 

I just posted what worked for me. My modules had not been updated for a year. Another problem that this fixed was that no matter what option of shipping you pick, it always defaulted to express. I'm not here to show you that I'm some great problem solver coder, this is just what fixed the problems on my sites. The same problems that everyone seemed to be having.

Link to comment
Share on other sites

Thanks for your work - BUT THIS IS NOT THE RIGHT FIX. Among other things the above changes (don't know whether you were being sloppy or what) include defunct international mail categories.

 

As noted on other threads the simple fix, IF YOU HAVE A MODULE THAT WAS UP TO DATE UNTIL AROUND A WEEK AGO, requires only that you ensure that the "keys" are sent as capital letters. I'm not sure anyone knows at this moment exactly what the USPS did (much less why they did it), but in any event for the moment that seems to solve the problem. And even if they go back to a case-insensitive set-up, it won't hurt to have your keys in all-caps.

 

I hope.

 

Big note:

 

If you just modify the keys to uppercase, you'll have to uninstall and reinstall your module to make sure the changes take effect. If you run the sql update, then I don't think you have to do it. I confess I'm not 100% clear on why the usps.php file is written the way that it is, but things seemed to work fine when I did both - uninstall and re-install, also just update the file and run the sql update. However, as others have noted, if you go the "quick" route and just modify to uppercase and re-install, be sure to locate or to copy your USPS userid, password, and module settings (at your admin modules page) before you remove the shipping module, since, when you reinstall it, you'll have to provide the info again.

 

Here's the fix for updated USPS modules:

 

My recommendation: go to http://addons.oscommerce.com/info/487 for working, updated modules and instructions. If you've performed custom alterations to your usps.php module, you'll have to do a file compare, and maybe strain your eyes and scratch your head a little.

 

As for the "newbie" question: It shouldn't really make much difference whether you run a sql update before or after changing the php file, as long as you do both. Not sure why you were getting the error you mentioned, but if you're running phpmyadmin, you should be able to find your store database (you may have more than one database set up on your server, I don't know), probably named something like "youruserid_p_os2 (63)" - click on it, then either click import if you're using a sql update file as in the contribution at the link directly above, or go to SQL and paste in the update info if you're just cutting and pasting.

 

If you go to the contribution link, and follow the instructions, it should work.

Relative newbie here. I found the usps.php file and changed the lower case words to caps as directed. I also tried uninstalling/reinstalling the usps moduke. However, I cannot find any SQL files, or a place ro update them. Please direct me to these files, please. Thanks.

 

Lark

Link to comment
Share on other sites

  • 2 weeks later...

Ok I've tried every thing that has been said to try on this thread and not a single thing has worked it defaults to Express shipping no matter what I do. I tried the Caps - nothing, tried the update fix - nothing, even uninstalled and delted the USPS.php and then reinstalled it and uploaded it - nothing. I also do not have any options to offer certain USPS shipping options. This blows because it was working great till they made these changes.

Link to comment
Share on other sites

Relative newbie here. I found the usps.php file and changed the lower case words to caps as directed. I also tried uninstalling/reinstalling the usps moduke. However, I cannot find any SQL files, or a place ro update them. Please direct me to these files, please. Thanks.

 

Lark

 

Best check to see that you're using the add-on that includes the SQL file, not the most recent one that includes only the usps.php file. But it's been a couple of weeks, so maybe you've figured that out for yourself by now. If you need help with PHPADMIN or SQL, then that's another issue.

Link to comment
Share on other sites

Ok I've tried every thing that has been said to try on this thread and not a single thing has worked it defaults to Express shipping no matter what I do. I tried the Caps - nothing, tried the update fix - nothing, even uninstalled and delted the USPS.php and then reinstalled it and uploaded it - nothing. I also do not have any options to offer certain USPS shipping options. This blows because it was working great till they made these changes.

If you follow all of the instructions at the COMPLETE fix (see prior post) at the link noted, it should work. Otherwise, much in this thread is irrelevant or mistaken, as previously noted (some good partial efforts, but not the complete solution). Various other problems have been noted on other threads, and you might want to search through them for more extensive discussion.

Link to comment
Share on other sites

  • 5 months later...

I have a quick question. I tried to do the SQL updates, but I took a look at my database and there is no configuration_key that equals 'MODULE_SHIPPING_USPS_TYPES' in the configuration table. Am I missing something?

 

Any help would be greatly appreciated, because I can't get my shipping module to work. Thanks.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...