Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 1 of 2
USPS First-Class Mail Fix
 
jhebert
Jr. Member
 
Total Posts:  8
Joined:  2008-03-01
 

The shipping module for the USPS is not working correctly. In the allowed_methods field, the only choice for First-Class is only First-Class. When this is selected, it does not show up in the selectable methods on the front end. The reason is that the response returns First-Class Mail, First-Class Mail Flat, and First-Class Mail Parcel; none of which match “First-Class”.

I have hard coded the First-Class options into the database, however, if I make a change in the configuration my manual edit is over-written. Are there plans to update this piece of code or can someone point me in the direction for correcting this? I’d love to figure it out and post for everyone but am just without the time to do so.

I have found Magento to be amazing to say the least. I am picking up the framework pretty quick, I just wish I had more time to contribute.

Thanks…

Jason

webdevology.com

 
Magento Community Magento Community
Magento Community
Magento Community
 
jhebert
Jr. Member
 
Total Posts:  8
Joined:  2008-03-01
 

Any news on this fix in the upcoming releases?

Jason

webdevology.com

 
Magento Community Magento Community
Magento Community
Magento Community
 
FetchDesigns
Sr. Member
 
Avatar
Total Posts:  124
Joined:  2008-04-11
Chicago, IL
 

What table did you make this fix in?  I am anxious to get my first class shipping up and running.  Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
MunchyMonster
Member
 
Avatar
Total Posts:  71
Joined:  2008-02-05
New Hampshire, USA
 

Not sure if this helps any but the USPS code that ships with Magento can be found here app\code\core\Mage\Usa\Model\Shipping\Carrier\Usps.php I can see a few hardcoded arrays in there, but I’m in no shape to read code right now.  Just figured I’d point and see if it helped anyone.

MunchyMonster

 
Magento Community Magento Community
Magento Community
Magento Community
 
FetchDesigns
Sr. Member
 
Avatar
Total Posts:  124
Joined:  2008-04-11
Chicago, IL
 

Thanks.  I didn’t see where I would make any adjustments in that file, though.  I could be wrong… if anyone knows of how to fix this at least temporarily please let me know.  Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
FetchDesigns
Sr. Member
 
Avatar
Total Posts:  124
Joined:  2008-04-11
Chicago, IL
 

For anyone wanting to make this fix, it is the table called “core_config_data” in the row with a “path” of “carriers/usps/allowed_methods”.  Add one or more of the below options in place of just “First-Class”

First-Class Mail Letter
First-Class Mail Flat
First-Class Mail Parcel

Thanks, Jason, for all your help.  Hopefully they will have this fixed up soon.

 
Magento Community Magento Community
Magento Community
Magento Community
 
brandondrew
Member
 
Avatar
Total Posts:  64
Joined:  2007-09-12
 

Thanks for this workaround!

FYI to anyone trying this: it didn’t work for me until I cleared the cache and sessions on my server and restarted Apache.  (Perhaps only one of those mattered, but I decided to be thorough rather than isolate what was the minimum necessary.)

 
Magento Community Magento Community
Magento Community
Magento Community
 
Killoff
Magento Team
 
Avatar
Total Posts:  17
Joined:  2008-05-22
 

You can add not existing methods in Usa/etc/config.xml to

<usps><allowed_methods>...</allowed_methods></usps>
<
usps><methods>...</methods></usps>

sections

 
Magento Community Magento Community
Magento Community
Magento Community
 
brandondrew
Member
 
Avatar
Total Posts:  64
Joined:  2007-09-12
 

To anyone wondering what Killoff is talking about (since there’s no such file as /Usa/etc/config.xml, relative to the Magento root), the file is /app/code/core/Mage/Usa/etc/config.xml .

 
Magento Community Magento Community
Magento Community
Magento Community
 
edesigninc
Jr. Member
 
Avatar
Total Posts:  17
Joined:  2008-03-14
Fresno, CA
 

Well I tried adding

First-Class Mail,First-Class Mail Letter,First-Class Mail Flat,First-Class Mail Parcel

to the <allowed_methods> and the <methods> in the app/code/core/Mage/Usa/etc/config.xml file

I also updated the allowed methods in the DB, I also modified the app/code/core/Mage/Usa/Model/Shipping/Carrier/usps/Usps.php with the following

Line 322
Add to top of service array

‘FIRST CLASS MAIL’ => Mage::helper(’usa’)->__(’First-Class Mail’),
‘FIRST CLASS MAIL LETTER’ => Mage::helper(’usa’)->__(’First-Class Mail Letter’),
‘FIRST CLASS MAIL FLAT’ => Mage::helper(’usa’)->__(’First-Class Mail Flat’),
‘FIRST CLASS MAIL PARCEL’ => Mage::helper(’usa’)->__(’First-Class Mail Parcel’),

Add to top of service_to_code array

‘First-Class Mail’ => ‘First-Class Mail’,
‘First-Class Mail Letter’ => ‘First-Class Mail Letter’,
‘First-Class Mail Flat’ => ‘First-Class Mail Flat’,
‘First-Class Mail Parcel’ => ‘First-Class Mail Parcel’,

but still no luck, I get the same message everytime. 
“This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.”

Can someone tell me how I can echo the XML message coming from USPS so I can see what the RAW problem is?

 
Magento Community Magento Community
Magento Community
Magento Community
 
brandondrew
Member
 
Avatar
Total Posts:  64
Joined:  2007-09-12
 

Try removing “First-Class Mail”, there’s no such thing (afaik) only the other three more specific kinds of first-class mail.  For what it’s worth, I didn’t make any changes to Usps.php, and it’s working for me.  So you might want to remove your changes to that until you get it working, and only then add them back to see what effect they have. 

If it’s still not working, you could try clearing your cache, deleting the sessions on the server, and restarting your server.  And dancing around the server with a rubber chicken.  smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
CreedFeed
Member
 
Total Posts:  74
Joined:  2007-08-31
Milwaukee, WI
 

See http://www.magentocommerce.com/boards/viewthread/10603/

 
Magento Community Magento Community
Magento Community
Magento Community
 
edesigninc
Jr. Member
 
Avatar
Total Posts:  17
Joined:  2008-03-14
Fresno, CA
 

Does this fix work for USPS as well as UPS?

CreedFeed - 02 July 2008 06:22 PM

See http://www.magentocommerce.com/boards/viewthread/10603/

 
Magento Community Magento Community
Magento Community
Magento Community
 
edesigninc
Jr. Member
 
Avatar
Total Posts:  17
Joined:  2008-03-14
Fresno, CA
 

Is there any way to see the RAW XML response from USPS, I want to know what’s going on!  X-cart allows you to view the RAW XML response, great for diagnostics!

I have been unable to make this work so far.  Very very frustrating.

I did the

<usps><allowed_methods>...</allowed_methods></usps>
<
usps><methods>...</methods></usps>
method.  And modified the USPS First Class options, but not even the other options work.  The other thing we are not propagated yet, running on a IP number at the moment, do you think this is causing USPS to return an error?

-Eric

 
Magento Community Magento Community
Magento Community
Magento Community
 
Rational Calvert
Jr. Member
 
Total Posts:  17
Joined:  2008-06-03
 

It may be worth mentioning, for the possible benefit of newbies like myself, that you apparently need a special user account with USPS specifically to access their web APIs. I actually discovered this fact by accident after I read through this thread and tried simply unselecting the First Class Mail shipping method as an available option. That didn’t work, BTW, but it made me think I properly should try and have an authoritative list of all possible USPS package/service types in front of me before I started thrashing around in the code and/or the database for the store. So I started poking around on the USPS web site looking for their API doc’s and stumbled across the sign-up form for API access in the process—I had been trying to use our regular USPS business shipper account ID up to that point.

In case this is also news to anyone else, you can sign up for web API access by going to http://www.usps.com/webtools/ and clicking the “Access USPS Web Tools” sign-up link. They e-mail you back a user ID and PW for the test server then you have to e-mail them again to promote your account to production status. Might want to mention in the e-mail that you just want to use rate look-up and package tracking support built into a third-party shopping cart and don’t need to print labels. Otherwise you’re supposed to mail them label samples for approval and jump through more hoops for other types of service.

Anyway, I now have my USPS API account in hand, supposedly set to production status and USPS shipping still doesn’t work in Magento (darn it), so I guess I’ll go ahead and take a stab at the hacks detailed up-thread. The doc’s for the USPS rate look-up API, including that list of all possible service type responses I was looking for can be found here, BTW:

HTML: http://www.usps.com/webtools/htm/RateCalculatorsv20.htm

PDF: http://www.usps.com/webtools/_pdf/RateCalculatorsv20.pdf

 
Magento Community Magento Community
Magento Community
Magento Community
 
johnr
Jr. Member
 
Total Posts:  2
Joined:  2008-05-07
 

I’ve just discovered that you need the API userID instead of the regular business account ID as well.  It would be nice to have that documented in the User Manual someday for other newbies. 

Anyway, I am still unable to get USPS rate calculations to work too and I can’t figure out why.  The only two variables that would affect this are the API UserID and the production URL (http://production.shippingapis.com/ShippingAPI.dll).  If anyone can explain how they were able to get USPS to work it would be very helpful to a large amount of us who are growing quite frustrated. 

Hopefully this thread can lead us out of the dark smile

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 2