USPS fix for Magento CE 1.4.x

Featured Image

If you are a Magento store owner or Magento developer, you probably already noticed that USPS shipping method instantly stopped working few days ago. There was no clear announcement or whatsoever to prepare us for this outcome.

Reason

The reason for this sudden malfunction is that USPS updated (probably) their API in a manner not compatible to the previous version and all relying applications, as Magento, had to be updated also.

Magento Commerce took care of this for Magento CE 1.4.2 for which patch has been created along with instructions to guide you through the patching process.

The problem is that there is a number of stores still on Magento CE 1.4.x for which, by my recent experience, the patch doesn’t work and crashes the store.

Solution

Here’s a quick fix I made just for these situations. It could be done better, but it’l serve the purpose and allow you’re store (or your client’s) to function properly. All you have to do is unpack contents of the zip file to Magento store root folder and that’s it 🙂

Thank you.


About Ivica Tadic

Partner

Certified Magento developer whose mission is to provide everything necessary to get the job done. Working with our client at Kuwait.

Read more posts by Ivica / Visit Ivica's profile

74 comments

  1. Mel,

    You probably need to bite the bullet and upgrade to the latest CE version. USPS has done updates to their API in July for the new Priority mail services and etc.

    Regards

  2. Interesting thing – MC 1.4.0.1 – even though I changed the code accordingly in config.xml, as well as abstract.php and usps.php – I unable to see the new methods in the admin area. I have cleared cache, reindexed (several times). Still cannot see the new methods to select them. Basically #6 in the steps never changes for me.
    I should mention: Countries outside the US work but not the us.

    I am using:

    <allowed_methods>Priority Mail Express 1-Day,Priority Mail 1-Day,Priority Mail 2-Day,Priority Mail 3-Day,Bound Printed Matter,Priority Mail Express,Priority Mail Express Flat Rate Envelope,Priority Mail Express Flat Rate Envelope Hold for Pickup,Priority Mail Express Flat Rate Envelope Sunday/Holiday Guarantee,Priority Mail Express Hold for Pickup,Priority Mail Express PO to PO,Priority Mail Express Sunday/Holiday Guarantee,Priority Mail Express International,Priority Mail Express International Flat Rate Envelope,First-Class Mail International Large Envelope,First-Class Mail International Letters,First-Class Mail International Package,First-Class,First-Class Mail,First-Class Mail Flat,First-Class Mail Large Envelope,First-Class Mail International,First-Class Mail Letter,First-Class Mail Parcel,First-Class Mail Package,Global Express Guaranteed (GXG),Global Express Guaranteed Non-Document Non-Rectangular,Global Express Guaranteed Non-Document Rectangular,Library Mail,Media Mail,Parcel Post,Priority Mail,Priority Mail Small Flat Rate Box,Priority Mail Medium Flat Rate Box,Priority Mail Large Flat Rate Box,Priority Mail Flat Rate Box,Priority Mail Flat Rate Envelope,Priority Mail International,Priority Mail International Flat Rate Box,Priority Mail International Flat Rate Envelope,Priority Mail International Small Flat Rate Box,Priority Mail International Medium Flat Rate Box,Priority Mail International Large Flat Rate Box,USPS GXG Envelopes</allowed_methods>

    Ideas why i can’t see the new selections in the admin? And why would it not be working for the US?

    Thanks,

  3. Thank you very much for this fix,
    I was having the same problem until i stumbled upon your site.
    I installed it on a Magento CE ver. 1.7.0.2 and its working flawlessly.
    Thank you again.

  4. I am getting the following error, please help!!!!

    Call to a member function setStore() on a non-object in /XXX/XXX/…………./app/code/core/Mage/Shipping/Model/Shipping.php on line 421

  5. Worked on 1.4.1.1 did have a problem at first then found that the url “http://production.shippingapis.com/ShippingAPI.dll” with “API” all caps works vs the “http://production.shippingapis.com/ShippingApi.dll”… Thanks for saving me from a costly upgrade!

  6. Just wanted to see if you can confirm this. The patch you created (which works great) does not fix the issue on the backend when the admin user goes to create an order.

  7. I’m glad to run into this site. Thanks for the patch. I’ve been pulling my hair out.

    After placing usps_patch into the magento root, what would I then need to do to have it execute?

    Thanks!!

  8. THANK YOU – I have spent a week trying to figure this out, talking to USPS, etc…. finally a solution!!!!! You rock.

  9. After adding patch I’m getting this:
    Invalid method Mage_Usa_Model_Shipping_Carrier_Usps::_getCachedQuotes(Array
    (
    [0] =>
    ALL7275800FLAT RATE BOXLARGEtrue

    )

  10. Thank you! Thank you! This along with adding “stg-” to the start of the shipping API URL fixed it for me using Magento 1.3.x. I was worried I would be forced to upgrade to 1.4.x which is even more of a memory hog.

  11. USPS actually sent out an email notice to everyone with an API key more than 6 months ago. I, too, didn’t notice. They are among those who feel that breaking the status quo is just fine. UPS, et al, would never make an API change that so drastically differed from the previous version.

    FWIW, I am not partial to how Magento parses the response from USPS. It’s done via a full string match. Instead, the responses should be searched for the smallest keyword that differentiates the different methods from each other.

    To break magento, usps added a trademark character to their replies. 😛

  12. Hey guys,

    I used this patch to fix my live store which was 1.3 and it worked great. I am now building a 1.5 version of the store in the background and I noticed that the USPS shipping isn’t working in 1.5.0.1 Does anyone else have the same problem, (maybe a solution?) thought I would ask here as most other sites I found appear completely clueless on the subject.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <blockquote cite=""> <code> <del datetime=""> <em> <s> <strike> <strong>. You may use following syntax for source code: <pre><code>$current = "Inchoo";</code></pre>.