Magento 购物车总计汇总
在 Magento 中,我试图在购物篮阶段对总价值进行四舍五入。我应用了折扣券,结果得到了像 0.24 这样的小数。我想将其四舍五入到最接近的数字。
它不会像四舍五入显示值那么简单。总计需要发送至 Paypal、Sagepay 等...
In Magento, I am trying to round up the grand total value at the shopping basket stage. I apply a discount voucher and end up with decimals like .24. I would like to round it to the nearest number.
It wouldn't be as simple as rounding the display value. The grand total needs to be sent to Paypal, Sagepay, etc...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须覆盖“总计”总类别并在那里实施舍入。
请参阅销售模块 config.xml(销售/总计部分)和税务模块 config.xml(相同,销售/总计部分)。
检查 Mage_Sales_Model_Quote_Address_Total_Grand 中的代码
You must override "grand total" total class and implement rounding there.
See Sales module config.xml (sales/totals section) and Tax module config.xml (same, sales/total section).
Inspect code from Mage_Sales_Model_Quote_Address_Total_Grand
您必须在collectTotals() 方法或收集总计时调用的某些方法中执行此操作。最好的选择是税收计算对象/方法。
You have to do it in collectTotals() method or some method that get's called while totals are collected. Best bet would be tax calculation object/methods.