所以我现在需要为我的购物车定制折扣价格。我会自己研究它,我意识到我可以修改视图.phtml和项目.phtml显示正确的价格。但我并不满意,因此我的眼睛盯着这行代码:
<?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>
我想这行代码的功能是从helper部分的某个地方调用价格并返回。我的问题是如何访问那里。
非常感谢。
更新1:在aton给了我一些提示后,我做了一些研究,然后我深入到文件DATA.php
中,发现了他提到的函数,即:
public function formatPrice($price)
{
return $this->getQuote()->getStore()->formatPrice($price);
}
但是,有什么方法可以更深入地研究$this->getQuote()->getStore()->formatPrice($price);
吗
再次感谢。
在上面提到的代码中,价格来自$_item->getCalculationPrice()
。
代码
<?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>
只需获取价格并将其格式化,即根据您的商店和其他内容添加货币符号。
如果您想知道formatPrice函数所在的位置,请导航到
app/code/core/Mage/checkout/Helper/Data.php
在这里,您将看到该函数的定义。
希望这会有所帮助。