Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

USPS made changes again?


kori80

Recommended Posts

Posted

Hey there fellas,

 

I realized our USPS Methods 5.2.1 started to display characters as follows for the last couple days without any editing on our end.

 

First-Class Mail $1.12

 

Priority Mail 1-Day<sup>™</sup> $5.60

 

Priority Mail Express 2-Day<sup>™</sup> $14.10

 

 

I was wondering if anyone else is having problems with it and if so, have a possible solution for the issue. Do they had another API change?

 

Thanks in advance.

Posted

I have cruising around the forum and haven't found any definitive fix yet. I'd be happy to just eliminate the "TM" part and get rid of the <sup> nonsense... Perhaps somebody will be along shortly with a real fix...

I find the fun in everything.

Posted

http://www.oscommerce.com/forums/topic/393466-heads-up-july-28-2013-usps-name-change-for-express-mail/

 

I'm not surprised that the USPS wouldn't know how to use a & trade; HTML entity. They're still back in the Pony Express era. Anyway, if <sup>TM</sup> is actually coded into the osC module, you could change it. If it's coming from their server, as a string, you might be able to $string = preg_replace('#<sup>TM</sup>#', '& trade;', $string). If it's being written directly to the browser, you're probably out of luck. (remove space between & and trade;)

 

If you're seeing the <sup>, it's most likely that you're getting the string from them and it's being "sanitized" to disable tags. You should be able to do the preg_replace() bit above, just as soon as the text is received from USPS.

 

The OP should report this thread and ask that it be moved to 2.x Support > Add-Ons > Shipping Modules.

Posted

I'm not surprised that the USPS wouldn't know how to use a & trade; HTML entity. They're still back in the Pony Express era.

And if you ever ordered supplies from their site you might wonder if Pony Express is too modern a term. Tim
Posted

this is what i did to remove the characters

 

after

list($type, $cost) = each($uspsQuote[$i]);

 

add

$type = str_replace('&lt;sup&gt;&#174;&lt;/sup&gt;', '', $type);
$type = str_replace('&lt;sup&gt;&#8482;&lt;/sup&gt;', '', $type);
$type = str_replace('**', '', $type);

 

 

http://www.oscommerce.com/forums/topic/393466-heads-up-july-28-2013-usps-name-change-for-express-mail/

 

I'm not surprised that the USPS wouldn't know how to use a & trade; HTML entity. They're still back in the Pony Express era. Anyway, if <sup>TM</sup> is actually coded into the osC module, you could change it. If it's coming from their server, as a string, you might be able to $string = preg_replace('#<sup>TM</sup>#', '& trade;', $string). If it's being written directly to the browser, you're probably out of luck. (remove space between & and trade;)

 

If you're seeing the <sup>, it's most likely that you're getting the string from them and it's being "sanitized" to disable tags. You should be able to do the preg_replace() bit above, just as soon as the text is received from USPS.

 

The OP should report this thread and ask that it be moved to 2.x Support > Add-Ons > Shipping Modules.

Posted

this is what i did to remove the characters

 

after

list($type, $cost) = each($uspsQuote[$i]);

 

add

$type = str_replace('&lt;sup&gt;&#174;&lt;/sup&gt;', '', $type);
$type = str_replace('&lt;sup&gt;&#8482;&lt;/sup&gt;', '', $type);
$type = str_replace('**', '', $type);

 

I applied the code above but did not seem to change anything.

 

Here's what I have and it still shows <sup>™</sup>.

 

$body = htmlspecialchars_decode($body);

$body = preg_replace('/\<sup\>\&reg;\<\/sup\>/', ' regimark', $body);

$body = preg_replace('/\<sup\>\&trade;\<\/sup\>/', ' tradmrk', $body);

Posted

this is what i did to remove the characters

DON'T DO THAT. You are probably in violation of their trademark and if they wanted to they could cut off your access to their services. If it's a trademarked term, you MUST use the ™ where they indicate. Just replace <sup>TM</sup> by & trade;.

 

I'll bet you could have fixed the strings earlier, before they were sanitized into < etc. Or does the USPS actually supply HTML code presanitized like that?

Posted

this fixed the trademark issue

$type = str_replace('&lt;sup&gt;&#174;&lt;/sup&gt;', '®', $type);
$type = str_replace('&lt;sup&gt;&#8482;&lt;/sup&gt;', '™', $type);

 

 

DON'T DO THAT. You are probably in violation of their trademark and if they wanted to they could cut off your access to their services. If it's a trademarked term, you MUST use the ™ where they indicate. Just replace <sup>TM</sup> by & trade;.

 

I'll bet you could have fixed the strings earlier, before they were sanitized into < etc. Or does the USPS actually supply HTML code presanitized like that?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...