【发布时间】:2012-10-24 23:51:21
【问题描述】:
Magento CE 版本。 1.7.0.2
我正在尝试从我们的 Magento 商店获取一些订单数据,以集成到我们的其他业务软件中。就我而言,我需要计算单个商品的价格加税。以下代码仅在 在目录中显示产品价格 设置为 Include 或 Both(在系统 > 配置 > 销售 > 税收中)时有效。如何在网站显示不含税价格的同时计算商品的税费?
$customer_tax_class = Mage::getModel('tax/calculation')->getRateRequest()->getCustomerClassId();
$_product = Mage::getModel('catalog/product')->loadByAttribute('sku',$skunumber);
$my_price = Mage::helper('tax')->getPrice($_product, $_product->getPrice(), true, $shippingAddress, $billingAddress, $customer_tax_class);
我也尝试过使用它,但我仍然得到不含税的价格(除非我更改上述显示设置):
$_finalPriceInclTax = Mage::helper('tax')->getPrice($_product, $_product->getFinalPrice(), true, $shippingAddress, $billingAddress, $customer_tax_class);
我知道这一定是可能的,因为 Magento 在您下订单时会计算税款。任何帮助将不胜感激。
【问题讨论】:
标签: magento