我怎样才能在 Magento 中修改这个价格函数

How can I get access to modify this price function in Magento

所以我现在需要为我的购物车定制折扣价。我会自己研究它,我意识到我可以修改 view.phtmlitem.phtml 以显示合适的价格。但是我并不满足,所以我的目光落在了这行代码上:

<?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>

我假设这行代码的功能是从 helper 部分的某个地方调用结账并 return 调用价格。我的问题是我怎样才能访问那里。

非常感谢。

更新 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

在这里你会看到那个函数的定义。

希望这会有所帮助。