Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

USPS made changes again?


kori80

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

What contribution are you using that still works? Mine is completely haywire.

 

EDIT: Okay, looks like: http://addons.oscommerce.com/info/487 right?

 

Can you confirm that the contrib still works, I just might need to run a strip_tags() on it?

 

http://php.net/manual/en/function.strip-tags.php

A little knowledge of php goes a long way.

Link to comment
Share on other sites

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);

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...