VirtueMart Forum

VirtueMart 1.1.x [ Old version - no longer supported ] => Shipping VM 1.1 => USPS (U.S. Postal Service) VM 1 => Topic started by: mbrando on January 03, 2011, 06:59:01 am

Title: USPS changed its mail service names
Post by: mbrando on January 03, 2011, 06:59:01 am
Hi,

I use the USPSv4 shipping module. It relies on predictable mail service names.

I've been throwing darts for a bit at trying to fix why no shipping options were showing up. It seems that they inserted html for making the REG text a superscript in all of the service names. removing it fixes this module. Here is how.

Changing line 314 in uspsv4.php

from This:
$serviceName = $serviceName->getText();

To this:
$serviceName = str_replace( "<sup>®</sup>" , "" , $serviceName->getText() ) ;

Seems to correct the issue.

The above corrects domestic shipping. Do the same for line 341 too and that should correct international.

Can you confirm the same on your end?
Title: Re: USPS changed its mail service names
Post by: seyi on January 03, 2011, 12:23:19 pm
Nice,  I originally edited the .cfg.php file to add  "<sup>®</sup>" and then used html_entity_decode to display the content correctly, but your way is better.  I do not know how long this code will work as it seems usps is changing things around, but at least for now I dont have complaining clients.
Title: Re: USPS changed its mail service names
Post by: mbrando on January 03, 2011, 14:08:55 pm
Hi Seyl,

It took hours of throwing darts to get figure out what exactly was the issue. At least we now know that it was related to naming convention and will look there first if they break it again.

- Mike
Title: Re: USPS changed its mail service names
Post by: mbrando on January 03, 2011, 14:35:25 pm
Hi,

Also add this:

$serviceName = str_replace( "<sup>™</sup>" , "" , $serviceName);   

below this on 314 and 341:
$serviceName = str_replace( "<sup>®</sup>" , "" , $serviceName->getText() ) ;

- Mike
Title: Re: USPS changed its mail service names
Post by: Seiko on January 03, 2011, 22:12:47 pm
Thanks for the fix!
Title: Re: USPS changed its mail service names
Post by: Jeremy - CodeDonors.com on January 07, 2011, 13:26:49 pm
Just happened to be browsing the forum and this thread saved my life! Some time ago I developed a USPS Quotes with Insurance module, and now it is updated & ready for the new year. I also added just about every possible service option while I was at it.

Check it out here and stop footing the bill for insurance!

http://codedonors.com/shipping-modules/usps-quotes-with-insurance-virtuemart-p-44.html

Title: Re: USPS changed its mail service names
Post by: mbrando on January 07, 2011, 14:39:53 pm
Just happened to be browsing the forum and this thread saved my life! Some time ago I developed a USPS Quotes with Insurance module, and now it is updated & ready for the new year. I also added just about every possible service option while I was at it.

Hi,

Since I saved your life and all ... I guess you owe me.   ;D

- Mike