Tags I am associated with:

Tags I am associated with: Microsoft SQL Server, IBM Cognos BI and Planning, Deltek Costpoint, Deltek Time & Expense, Magento, Intuit QuickBooks, Visual Basic 6, SSIS, Oracle, SQL development, data warehouse, reporting, eCommerce, accounting, finance, ETL

Sunday, July 17, 2011

Magento 1.5.1.0 fix for USPS shipping

Background: finally got the production url from USPS so I can update the configuration in Magento.

First issue: USPS email sent to me said to use URL: http://production.shippingapis.com
Resolution: I had to add the dll name at the end to make it work http://production.shippingapis.com/ShippingAPI.dll

Second issue: Only library mail shows up as a USPS shipping method.
This is caused by USPS renaming the shipping method names and also possibly by Magento core developers who relied on the shipping names instead of some type of unique id's.
I read thru many posting on the web regarding fixes... I had to end up using a combination of the 2 different solutions to make mine setup work.
Resolution:

  •  Copy Usps.php from app/code/core/Mage/Usa/Model/Shipping/Carrier/
    to app/code/local/Mage/Usa/Model/Shipping/Carrier/
  • Edit the new Usps.php file in app/code/local/.....
  • Find
                                if (is_object($xml->Package) && is_object($xml->Package->Postage)) {
                                    foreach ($xml->Package->Postage as $postage) {
    and Replace with
                                if (is_object($xml->Package) && is_object($xml->Package->Postage)) {
                                    foreach ($xml->Package->Postage as $postage) {
                                        $postage->MailService = str_replace('®', '', strip_tags(htmlspecialchars_decode(htmlspecialchars_decode((string)$postage->MailService))));
    • then Find
                                  if (is_object($xml->Package) && is_object($xml->Package->Service)) {
                                      foreach ($xml->Package->Service as $service) {
      and Replace with
                                  if (is_object($xml->Package) && is_object($xml->Package->Service)) {
                                      foreach ($xml->Package->Service as $service) {
                                          $service->SvcDescription = str_replace('®', '', strip_tags(htmlspecialchars_decode(htmlspecialchars_decode((string)$service->SvcDescription))));

    I had to restart my Zend Server and clear its cache to take in the new code in local folder

No comments:

Post a Comment