我想在我的产品页面上获取元标记的含税最终价格。

我目前有这个,但这是不含税的价格:

<?php echo number_format($_product->getpriceIncludingTax(), '2', '.', ',');?>

如何显示此元的含税价格?

有帮助吗?

解决方案

不是直接的解决方案,而是一些潜在的指针/想法。

查看税务助手类。 Mage::helper('tax');那里有一个方法 ->getPrice可能 为你工作。还有很多其他有趣的方法值得研究。

还可以看看 Mage_Catalog_Block_Product_View_Type_Configurable::getJsonConfig 在那里您会看到一些与税务相关的逻辑,这些逻辑也可能有用/让您了解可以做什么。

查看方法的中间部分,代码开头为 $taxCalculation = Mage::getSingleton('tax/calculation');

这里还有一些潜在的帮助: Mage_XmlConnect_Block_Catalog_Product_Price_Default::collectProductPrices

请参阅该例程中的代码如下:

$price = $taxHelper->getPrice($product, $product->getPrice());
$regularPrice = $taxHelper->getPrice($product, $product->getPrice(), $simplePricesTax);
$finalPrice = $taxHelper->getPrice($product, $product->getFinalPrice());
$finalPriceInclTax = $taxHelper->getPrice($product, $product->getFinalPrice(), true);
许可以下: CC-BY-SA归因
scroll top