Magento在非模板文件中获得含税的价格 [英] Magento get price including tax in a none-template file
本文介绍了Magento在非模板文件中获得含税的价格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
目前,我正试图在我的产品Feed的php文件中获得包含税款的产品价格。目前我有这样的代码:
$ _ product = Mage :: getModel('catalog / product') - > load ($的productId);
$ _priceIncludingTax = $ this-> helper('tax')
- > getPrice($ _ product,$ _product-> getFinalPrice());
问题在于,当然'$ this->'部分不能很好地工作从文件中。
任何人都知道我仍然可以在这个文件中得到包括税的价格吗?
Mage :: helper('tax')
您的完整代码是:
$ _ product =法师:: getModel( '目录/产品') - >负载($的productId);
$ _priceIncludingTax = Mage :: helper('tax')
- > getPrice($ _ product,$ _product-> getFinalPrice());
At the moment i am trying to get the product price including tax in a php file for my product feed. I have this code at the moment:
$_product = Mage::getModel('catalog/product')->load($productId); $_priceIncludingTax = $this->helper('tax') ->getPrice($_product, $_product->getFinalPrice());
Problem is that since that of course the '$this->' part doesn't work so well from the file. Anyone know how i can still get the price including tax in this file?
解决方案You can get a helper-instance in any file using:
Mage::helper('tax')
Your full code is:
$_product = Mage::getModel('catalog/product')->load($productId); $_priceIncludingTax = Mage::helper('tax') ->getPrice($_product, $_product->getFinalPrice());
这篇关于Magento在非模板文件中获得含税的价格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文