本文介紹了Magento 在非模板文件中獲取含稅價格的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
目前,我正在嘗試在我的產品 Feed 的 php 文件中獲取含稅的產品價格.我現在有這個代碼:
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());
問題在于,當然,'$this->' 部分在文件中不能很好地工作.有誰知道我如何仍然可以在此文件中獲得含稅價格?
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')
您的完整代碼是:
$_product = Mage::getModel('catalog/product')->load($productId);
$_priceIncludingTax = Mage::helper('tax')
->getPrice($_product, $_product->getFinalPrice());
這篇關于Magento 在非模板文件中獲取含稅價格的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!