kori80 Posted July 29, 2013 Posted July 29, 2013 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.
FixItPete Posted July 30, 2013 Posted July 30, 2013 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.
MrPhil Posted July 30, 2013 Posted July 30, 2013 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.
knifeman Posted July 30, 2013 Posted July 30, 2013 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
maxtors Posted July 30, 2013 Posted July 30, 2013 this is what i did to remove the characters after list($type, $cost) = each($uspsQuote[$i]); add $type = str_replace('<sup>®</sup>', '', $type); $type = str_replace('<sup>™</sup>', '', $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.
panicgripdesigns Posted July 30, 2013 Posted July 30, 2013 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.
kori80 Posted July 30, 2013 Author Posted July 30, 2013 this is what i did to remove the characters after list($type, $cost) = each($uspsQuote[$i]); add $type = str_replace('<sup>®</sup>', '', $type); $type = str_replace('<sup>™</sup>', '', $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\>\®\<\/sup\>/', ' regimark', $body); $body = preg_replace('/\<sup\>\™\<\/sup\>/', ' tradmrk', $body);
MrPhil Posted July 31, 2013 Posted July 31, 2013 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?
maxtors Posted July 31, 2013 Posted July 31, 2013 this fixed the trademark issue $type = str_replace('<sup>®</sup>', '®', $type); $type = str_replace('<sup>™</sup>', '™', $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?
GetSirius Posted August 4, 2013 Posted August 4, 2013 Thanks kori80 and maxtors, that fixed it for me. Appreciated very much!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.