Jump to content
bad_lemming

[Contribution] - USPS Methods

Recommended Posts

Hello Greg!

 

So I have 4.1.4 installed, and as of Sept. 5, I am having a problem where when a logged in customer attempts to Checkout, the USPS module seems to be hanging. When I say that I mean when they go to the Shipping page, it just loads and loads and loads and loads (taking about 5 minutes before seemingly timing out), and then returns this error:

 

An error occured with the USPS shipping calculations.

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

 

Now, when I replace the location of the database (ex: 'production.shippingapis.com') with something such as 'wefewfewfwefew' the page loads as fast as before the problem (very fast), but with the same error (obviously):

 

An error occured with the USPS shipping calculations.

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

 

So I'm wondering why it's hanging when I'm trying to get to the real prod server? Any ideas?

 

Thanks so much!

Is this an intermittent problem or does this happen every time? If intermittent and if you click refresh, does the page load immediately? If yes, this could be a problem with either your server's network connection or your host's network connection. I had a simmilar problem but found that my router was reseting itself every 20 minutes causing intermittent havoc. I also run into the problem when loading the page too many times.

 

If this is happening every time, check in usps.php and comment out the email forward code. I can't remember if v4.1.4 was commented out by default. If this doesn't work, try using v4.2.x and replace your language file too. It could be that your server is trying to connect to localhost.com and is having a conflict of some kind, but I doubt it.

 

It seems like I've had this problem before but I can't remember what I was doing to cause it.

Edited by naps1saps

Share this post


Link to post
Share on other sites
I know USPS made some changes to the name of services on May 12th. v3.0 uses USPS version 2 API. If you can get version 3.0 to work, you can get 4.2.x to work because there were no changes to the files. Just make sure you replace the language file with the one that comes with it.

 

 

Hi Greg:

 

Ok, second time I've tried the 4.3.0 contrib. It did not work the 1st time, gave me a parse error when trying to access the admin..

 

I then updated my shipping method to 3.0. This allowed domestic express to finally work. 1st class international still refuses to show up for the customer even though I have it selected in the shipping mod.

 

I followed the instructions, unloaded usps shipping mod, uploaded the two usps.php, made the manual changes step 5, step 6 and uploaded it to the server. This time I got this error:

 

Fatal error: Cannot redeclare tep_mod_select_option() (previously declared in /home/content/x/x/x/x/html/catalog/admin/includes/functions/general.php:759) in /home/content/x/x/x/x/html/catalog/admin/includes/functions/general.php on line 772

 

The error would not let me access nor log into admin.

 

Any suggestions? I really need 1st class intl to work. Thanks in advance for any help.

 

Silvergren

Share this post


Link to post
Share on other sites

I know USPS made some changes to the name of services on May 12th. v3.0 uses USPS version 2 API. If you can get version 3.0 to work, you can get 4.2.x to work because there were no changes to the files. Just make sure you replace the language file with the one that comes with it.

 

Hi Greg:

 

Ok, second time I've tried the 4.3.0 contrib. It did not work the 1st time, gave me a parse error when trying to access the admin..

 

I then updated my shipping method to 3.0. This allowed domestic express to finally work. 1st class international still refuses to show up for the customer even though I have it selected in the shipping mod.

 

I followed the instructions, unloaded usps shipping mod, uploaded the two usps.php, made the manual changes step 5, step 6 and uploaded it to the server. This time I got this error:

 

Fatal error: Cannot redeclare tep_mod_select_option() (previously declared in /home/content/x/x/x/x/html/catalog/admin/includes/functions/general.php:759) in /home/content/x/x/x/x/html/catalog/admin/includes/functions/general.php on line 772

 

The error would not let me access nor log into admin.

 

Any suggestions? I really need 1st class intl to work. Thanks in advance for any help.

 

P.s. I looked in the database, there is no shipping process, the only process that has shipping is one called products_shipping... that has a warning on it, saying "no index defined!"

 

Silvergren

Share this post


Link to post
Share on other sites

Earlier in this thread are the replacement names used by USPS, and where to change them in the contrib.

basically the case was the change, but some were labelled a little differently.

 

includes\modules\shipping\usps.php(47): $this->types = array('EXPRESS' => 'Express Mail', 'FIRST CLASS' => 'First-Class Mail', 'PRIORITY' => 'Priority Mail', 'PARCEL' => 'Parcel', 'BPM' => 'Bound Printed Material', 'Library' => 'Library', 'Media' => 'Media Mail');

 

and

 

includes\modules\shipping\usps.php(154): tep_db_query("insert into " . TABLE_CONFIGURATION . " ( configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Domestic Shipping Methods', 'MODULE_SHIPPING_USPS_TYPES', 'EXPRESS, PRIORITY, FIRST CLASS, PARCEL, BPM, Library, Media,', 'Select the domestic services to be offered:', '6', '14', 'tep_cfg_select_multioption(array(\'EXPRESS\', \'PRIORITY\', \'FIRST CLASS\', \'PARCEL\',\'BPM\',\'Library\',\'Media\'), ',  now())");

 

And

 

includes\modules\shipping\usps.php(155): tep_db_query("insert into " . TABLE_CONFIGURATION . "  (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Int\'l Shipping Methods', 'MODULE_SHIPPING_USPS_TYPES_INTL', 'GXG, GXG Non-Doc Rect, GXG Non-Doc Non-Rect, Express, Express FlatEnv, Priority Intl, Priority Intl FlatEnv, Priority Intl FlatBox, FirstClass Intl', 'Select the international services to be offered:', '6', '15', 'tep_cfg_select_multioption(array(\'GXG\', \'GXG Non-Doc Rect\', \'GXG Non-Doc Non-Rect\', \'Express\', \'Express FlatEnv\', \'Priority Intl\', \'Priority Intl FlatEnv\', \'Priority Intl FlatBox\', \'FirstClass Intl\'),',  now())");

 

Mind you this is edited to match up the code from v2.9.2

Do not drop this directly into your instance until you compare the structures and code to make sure it is compatible with your revision.

Also, the line numbers may not match considering the extensive work that has been applied since build 2.9.2.

 

I cannot suggest strongly enough that when updating and installing contribs you use a tool such as examdiff, or beyondcompare to look at the files you will be adding and updating compared to what already exists in your catalog.

 

Of course you should always download and datestamp a backup before applying any new contrib.

This is your safety net.

Duplicate the back up to another directory to be your transitional copy that you perform edits on.

I even keep a third testing version just in case.

 

Additionally, you should always backup your database before executing any sql statements against your existing database.

This will always permit you to roll back to a working revision.

 

I hope this helps.

Share this post


Link to post
Share on other sites

Also all references still in my usps.php that cover international (some have been edited out since I limit the selections)

 

includes\modules\shipping\usps.php(52): 'Express' => 'Express Mail International (EMS)',
includes\modules\shipping\usps.php(53): 'Express FlatEnv' => 'Express Mail International (EMS) Flat Rate Envelope',
includes\modules\shipping\usps.php(54): 'Priority Intl' => 'Priority Mail International',
includes\modules\shipping\usps.php(55): 'Priority Intl FlatEnv' => 'Priority Mail International Flat Rate Envelope',
includes\modules\shipping\usps.php(56): 'Priority Intl FlatBox' => 'Priority Mail International Flat Rate Box',
includes\modules\shipping\usps.php(57): 'FirstClass Intl' => 'First-Class Mail International');
includes\modules\shipping\usps.php(155): tep_db_query("insert into " . TABLE_CONFIGURATION . "  (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Int\'l Shipping Methods', 'MODULE_SHIPPING_USPS_TYPES_INTL', 'GXG, GXG Non-Doc Rect, GXG Non-Doc Non-Rect, Express, Express FlatEnv, Priority Intl, Priority Intl FlatEnv, Priority Intl FlatBox, FirstClass Intl', 'Select the international services to be offered:', '6', '15', 'tep_cfg_select_multioption(array(\'GXG\', \'GXG Non-Doc Rect\', \'GXG Non-Doc Non-Rect\', \'Express\', \'Express FlatEnv\', \'Priority Intl\', \'Priority Intl FlatEnv\', \'Priority Intl FlatBox\', \'FirstClass Intl\'),',  now())");

Share this post


Link to post
Share on other sites
If this is happening every time, check in usps.php and comment out the email forward code. I can't remember if v4.1.4 was commented out by default. If this doesn't work, try using v4.2.x and replace your language file too. It could be that your server is trying to connect to localhost.com and is having a conflict of some kind, but I doubt it.

 

It seems like I've had this problem before but I can't remember what I was doing to cause it.

 

Thanks for taking the time to help out Greg!

 

Yep - happening every time.

 

I can't see the email forward code in usps.php.

 

Tried changing to 4.2.x, tried re-inserting the SQL statement and reinstalling USPS Methods.

 

I'm really stuck on this. :(

Share this post


Link to post
Share on other sites
Tried changing to 4.2.x, tried re-inserting the SQL statement and reinstalling USPS Methods.

 

 

Did you revert the sql and then re-apply?

Or did you just run the statements again, without backing them out?

 

Big differences between revert and apply and just overlaying.

Share this post


Link to post
Share on other sites
Did you revert the sql and then re-apply?

Or did you just run the statements again, without backing them out?

 

Big differences between revert and apply and just overlaying.

 

Yes, ran against a backed up, pre-3.0 version of USPS Methods.

 

Problem seems to be connecting or receiving info from the USPS server, though. When l change the location of the USPS server in the usps.php to something that's gibberish, it loads right away - albeit w/ the same error.

Share this post


Link to post
Share on other sites
Did you request to be put to the live USPS server, and have your confirmation code?

 

 

Yup! lt was actually live and working on this server for over 2 years - through 2 USPS changes/updates (where l had to go in and update the USPS Methods module). Just all of a sudden broke. Real weird.

Share this post


Link to post
Share on other sites

I just tried to add 4.3.0 ALPHA to a fresh install of RC2. After I modified all the files and replaced them on the server, I installed the module without any problem via the admin. BUT, when I save all my options, it changes everything to "Array" and obviously doesn't work on the front end.

 

Any ideas why this is happening? Thanks!

Share this post


Link to post
Share on other sites
Yup! lt was actually live and working on this server for over 2 years - through 2 USPS changes/updates (where l had to go in and update the USPS Methods module). Just all of a sudden broke. Real weird.

Hmmm, You should see if your hosting provider has performed any system updates, especially on the php or mysql deployments.

Did you apply any other contrib recently?

Share this post


Link to post
Share on other sites
Also all references still in my usps.php that cover international (some have been edited out since I limit the selections)

 

includes\modules\shipping\usps.php(52): 'Express' => 'Express Mail International (EMS)',
includes\modules\shipping\usps.php(53): 'Express FlatEnv' => 'Express Mail International (EMS) Flat Rate Envelope',
includes\modules\shipping\usps.php(54): 'Priority Intl' => 'Priority Mail International',
includes\modules\shipping\usps.php(55): 'Priority Intl FlatEnv' => 'Priority Mail International Flat Rate Envelope',
includes\modules\shipping\usps.php(56): 'Priority Intl FlatBox' => 'Priority Mail International Flat Rate Box',
includes\modules\shipping\usps.php(57): 'FirstClass Intl' => 'First-Class Mail International');
includes\modules\shipping\usps.php(155): tep_db_query("insert into " . TABLE_CONFIGURATION . "  (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Int\'l Shipping Methods', 'MODULE_SHIPPING_USPS_TYPES_INTL', 'GXG, GXG Non-Doc Rect, GXG Non-Doc Non-Rect, Express, Express FlatEnv, Priority Intl, Priority Intl FlatEnv, Priority Intl FlatBox, FirstClass Intl', 'Select the international services to be offered:', '6', '15', 'tep_cfg_select_multioption(array(\'GXG\', \'GXG Non-Doc Rect\', \'GXG Non-Doc Non-Rect\', \'Express\', \'Express FlatEnv\', \'Priority Intl\', \'Priority Intl FlatEnv\', \'Priority Intl FlatBox\', \'FirstClass Intl\'),',  now())");

 

 

Hi, I've tried using it with the way you have it here, I've tried it with and with out the - (dash) and tried it with and with out the - for the 4.3.0 contrib, none of them work. 1st class intl refuses to show up. What do you think could be causing the problem?

Share this post


Link to post
Share on other sites
(minionsweb @ Sep 17 2008, 07:14 AM) *

Also all references still in my usps.php that cover international (some have been edited out since I limit the selections)

 

CODE

includes\modules\shipping\usps.php(52): 'Express' => 'Express Mail International (EMS)',

includes\modules\shipping\usps.php(53): 'Express FlatEnv' => 'Express Mail International (EMS) Flat Rate Envelope',

includes\modules\shipping\usps.php(54): 'Priority Intl' => 'Priority Mail International',

includes\modules\shipping\usps.php(55): 'Priority Intl FlatEnv' => 'Priority Mail International Flat Rate Envelope',

includes\modules\shipping\usps.php(56): 'Priority Intl FlatBox' => 'Priority Mail International Flat Rate Box',

includes\modules\shipping\usps.php(57): 'FirstClass Intl' => 'First-Class Mail International');

includes\modules\shipping\usps.php(155): tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Int\'l Shipping Methods', 'MODULE_SHIPPING_USPS_TYPES_INTL', 'GXG, GXG Non-Doc Rect, GXG Non-Doc Non-Rect, Express, Express FlatEnv, Priority Intl, Priority Intl FlatEnv, Priority Intl FlatBox, FirstClass Intl', 'Select the international services to be offered:', '6', '15', 'tep_cfg_select_multioption(array(\'GXG\', \'GXG Non-Doc Rect\', \'GXG Non-Doc Non-Rect\', \'Express\', \'Express FlatEnv\', \'Priority Intl\', \'Priority Intl FlatEnv\', \'Priority Intl FlatBox\', \'FirstClass Intl\'),', now())");

 

Hi, I've tried using it with the way you have it here, I've tried it with and with out the - (dash) and tried it with and with out the - for the 4.3.0 contrib, none of them work. 1st class intl refuses to show up. What do you think could be causing the problem?

 

 

Oh and one other thing, when I'd updated to the 3.0 shipping methods, I ran did the 2.9.2 mysql thing and this is what was returned... myslq made a couple comments:

 

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';# MySQL returned an empty result set (i.e. zero rows).

 

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';# MySQL returned an empty result set (i.e. zero rows).

 

Is that normal? Did I do it wrong?

Edited by Silvergren

Share this post


Link to post
Share on other sites

One other thing I want to mention, I contacted USPS to see if perhaps my password is the problem. This is the response they sent back:

 

Dear USPS Customer,

 

Thank you for contacting the USPS Internet Customer Care Center. You may enter anything into the password field of your third party software in order to get around any field requirements the software may have. Since the webtools no longer checks for neither a password nor the contents if one is sent, any value can be entered in order to meet the requirements of your third party software.

 

 

USPS Internet Customer Care Center

icustomercare@usps.com

 

Apparently passwords is no longer requirded for the production server...

Share this post


Link to post
Share on other sites
One other thing I want to mention, I contacted USPS to see if perhaps my password is the problem. This is the response they sent back:

 

 

 

Apparently passwords is no longer requirded for the production server...

Maybe I should take out the password field too.

Share this post


Link to post
Share on other sites

Ugh... It's really hard to try and troubleshoot when my OSCommerce installation doesn't have those errors. I am using the same module everyone else is using and it works perfectly (for me). So If you're having problems and need it to work "yesterday", please use the previous version untill I can work out the kinks in this Beta with the "Beta Testers".

 

I appreciate everyone's involvement but please be patient with me as college has just started and I'm taking online courses, school courses, working one job, and trying to run a business all at the same time.

Share this post


Link to post
Share on other sites
Ugh... It's really hard to try and troubleshoot when my OSCommerce installation doesn't have those errors. I am using the same module everyone else is using and it works perfectly (for me). So If you're having problems and need it to work "yesterday", please use the previous version untill I can work out the kinks in this Beta with the "Beta Testers".

 

I appreciate everyone's involvement but please be patient with me as college has just started and I'm taking online courses, school courses, working one job, and trying to run a business all at the same time.

 

 

Hi Greg, you sound incredibly busy! Kudos to you for all your hard work and help!

 

Just a thought, while I was trying to add a different contrib for something else, I saw references where shipping statements had been commented out, and some individual shipping thing by phpmom.com was put in its place. Those references are also on other php pages then the ones you have us work on... could that have something to do with why I cannot get 4.3.0 working... I'm not taking out the right things.. or uncommenting what should be commented?

Share this post


Link to post
Share on other sites

Hi All,

 

I have been using this module and I love it.

My problem is when some one purchase 2 or more units from the same product. The module doesn't sum the total weight (Product weight x quantity) but just using 1 unit weight.

This way the USPS API returns the fees for one unit even though the customer has ordered more from the same product. This causes my shop to show a wrong USPS fees.

Example: product A weights 4 oz.

Some one ordered 5 of product A, the USPS module fess will be for 4 oz instead of 20 oz.

 

Can some one help me with this issue? Am I doing something wrong?

 

Thanks

Share this post


Link to post
Share on other sites

I installed USPS Methods 4.1.4 today. It is a great contribution! However, while I have done everything I am still stuck on one part. My domestic mail doesn't respect the selection made on the delivery page. By the time I get to confirmation, it just selects whatever is first in the list. I was not sure why but I have been reading up on the uppercase problem that occurred in November of 2007 and I suspect directly correlated. However, my version is after that and comments in the revision history imply the problem was dealt with. Is anyone else noticing this behavior? Are the installation instructions complete or are there more steps? Is there something additionally I have to do such that selection is respected. I have now hacked around a bit with the case of some of the file but net result is still:

An error occured with the USPS shipping calculations.

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

 

Keep in mind I had it working from a visual perspective of listing the options (both international and domestic...international still works) but my monkeying around has broken the domestic. Again, I think I can get back to where I was but I am still no closer to having the code respect the selection made by the user. Ideas or advice? Any help would be appreciated.

 

Thanks,

Mike

Share this post


Link to post
Share on other sites

I'm having a problem with this contribution.

 

Everything seems to be installing fine, but when I install the module and then edit the information, all the fields get replaced with the word "ARRAY" instead of displaying the information I edited.

 

Any thoughts?

 

never mind didn't update one of the files correctly... doh!

Edited by archeon

Share this post


Link to post
Share on other sites
I installed USPS Methods 4.1.4 today. It is a great contribution! However, while I have done everything I am still stuck on one part. My domestic mail doesn't respect the selection made on the delivery page. By the time I get to confirmation, it just selects whatever is first in the list. I was not sure why but I have been reading up on the uppercase problem that occurred in November of 2007 and I suspect directly correlated. However, my version is after that and comments in the revision history imply the problem was dealt with. Is anyone else noticing this behavior? Are the installation instructions complete or are there more steps? Is there something additionally I have to do such that selection is respected. I have now hacked around a bit with the case of some of the file but net result is still:

An error occured with the USPS shipping calculations.

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

 

Keep in mind I had it working from a visual perspective of listing the options (both international and domestic...international still works) but my monkeying around has broken the domestic. Again, I think I can get back to where I was but I am still no closer to having the code respect the selection made by the user. Ideas or advice? Any help would be appreciated.

 

Thanks,

Mike

 

Based on someone's advice that worked in 4.2.1, I decided to upgrade to 4.3.0 seeing comment on contribution site of:

"*Fixed a couple coding errors found in the default configurations"

Still no dice...now both domestic and foreign say:

An error occured with the USPS shipping calculations.

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

 

Any ideas? I'm thinking of cleaning up and going back to 4.1.4 since last 'official' release (not alpha or beta)...although that will just get me back to where I was...

Share this post


Link to post
Share on other sites
Based on someone's advice that worked in 4.2.1, I decided to upgrade to 4.3.0 seeing comment on contribution site of:

"*Fixed a couple coding errors found in the default configurations"

Still no dice...now both domestic and foreign say:

An error occured with the USPS shipping calculations.

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

 

Any ideas? I'm thinking of cleaning up and going back to 4.1.4 since last 'official' release (not alpha or beta)...although that will just get me back to where I was...

 

For anyone struggling with me, I have a little better behavior now. While I haven't fully tested, my changes appear to have worked. I took 4.1.4, followed the instructions up to here:

 

**********

* STEP 7 *

**********

 

Enable the USPS shipping module:

Go to the shipping module page, Admin -> Modules -> Shipping.

Click the green button next to United States Postal Service.

 

 

after this, I ran the following script:

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';

 

I can't promise this is exactly best solution...it just appears to be working for me which is why I thought I would offer for those similarly struggling as I was. Thanks.

Share this post


Link to post
Share on other sites
Have not followed the thread in quite some time...I have a quick question about features.

 

Has a dimensional weight feature been added to this contrib?

 

Thanks

 

 

 

Really need dimensional support. Has anyone done anything with this feature? I have seen it asked for for a couple years and I can't believe no one has come up with a solution.

 

Thanks

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

×