Magento - 创建最低运费
我们使用 USPS API 进行国际运输。 API 返回运费,我们添加 % 手续费。我们想要设置最低费用,例如,如果运费+手续费低于 5 美元,我们想要将运费设置为 5 美元。这是否需要编写完整的运输模块或仅调整 USPS 模块?
We use USPS API for international shipping. The API returns a shipping cost and we add % Handling charge. We want to set a minimum charge, e.g., if shipping + handling is less than $5 we want to set the shipping price to $5. Would this require writing a full shipping module or just adapt the USPS module?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过仅覆盖 USPS 模块的一部分来实现此目的。应用处理的方法位于
Mage_Shipping_Model_Carrier_Abstract
中:要为美国覆盖此方法,请在
Mage_Usa_Model_Shipping_Carrier_Usps
上创建一个新的模型覆盖(请参阅其他地方以了解如何设置此覆盖):将实行运费“下限”。请记住,在某些情况下,这可能会导致用户注意到奇怪的结果。举个人为的例子:
保持光明正大,让他们知道你正在这样做。
希望有帮助!
谢谢,
乔
You can accomplish this by overriding just a portion of the USPS module. The method that applies handling is in
Mage_Shipping_Model_Carrier_Abstract
:To override this method for US, create a new model override on
Mage_Usa_Model_Shipping_Carrier_Usps
(see elsewhere for how to set up this override):This will implement a "floor" for shipping prices. Keep in mind that this may in some cases lead to results that users notice as being odd. For contrived example:
Keep it aboveboard and let them know that you're doing this.
Hope that helps!
Thanks,
Joe