Magento关于USPS运输方式的使用总结

1. 申请好USPS
后,会收到邮件,附有相关信息。

2.Magento后台关键设置好User ID和Gateway URL,另外最好把debug打开,以便查看shipping_usps.log。

3.如果没有一次性成功,通常会遇到“This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.
”这个提示。

关于这个问题,在日志文件里有遇到的三点错误描述:

  • Invalid URI supplied
  • Authorization failure.  You are not authorized to connect to this server.
  • API Authorization failure. RateV3 is not a valid API name for this protocol.

第一点,绑定的地址错了

第二点,User ID错误(第一次保存OK,再次保存后no working. QoQ)

第三点,测试环境的时候,没接受完整的RateV3(改到生产环境即可)

-------------------------------------------------------------------------------------------------------------------------------------------------

(2010年12月17日,美国邮政服务,改变了国内航运服务。这些变化并造成USPS运费计算器在Magento停止工作。原因是:运输方式名称那边现在有一个“®”的结束象征)

此外,在上述情况下,有额外处理:

文件:/app/code/core/Mage/Usa/Model/Shipping/Carrier/Usps.php

查找,

foreach ($xml->Package->Postage as $postage) {

循环里加入

$postage->MailService = str_replace("<sup>®</sup>","",(string)$postage->MailService);

查找,

foreach ($xml->Package->Service as $service) {

 

循环里加入

 

$service->SvcDescription = str_replace("<sup>®</sup>","",(string)$service->SvcDescription);

 

 

另外更新First Class Mail。文件: /app/code/core/Mage/Usa/etc/config.xml

查找

,First-Class Mail International Large Envelope,First-Class Mail International Letters,First-Class Mail International Package,First-Class,First-Class Mail,First-Class Mail Flat,First-Class Mail Large Envelope,First-Class Mail International,First-Class Mail Letter,First-Class Mail Parcel

替换为

,First-Class Mail International Large Envelope**,First-Class Mail International Letters**,First-Class Mail International Package**,First-Class Mail Package,First-Class Mail Large Envelope

另外要联系ICCC那边,通知将访问权限调整到生成环境的API地址。

这样关于Magento使用USPS运输方式
就OK了。

附,

 

USPS的测试API地址:http://testing.shippingapis.com/ShippingAPITest.dll 或者 https://secure.shippingapis.com/ShippingAPITest.dll

USPS生产环境地址:http://production.shippingapis.com/ShippingAPI.dll 或者 https://production.shippingapis.com/ShippingAPI.dll