【问题标题】:How can I get access to modify this price function in Magento如何在 Magento 中修改此价格功能
【发布时间】:2015-03-25 04:35:24
【问题描述】:

所以我现在需要为我的购物车自定义折扣价。我会自己研究它,我意识到我可以修改 view.phtmlitem.phtml 以显示正确的价格。但是我不满意,所以我把目光投向了这行代码:

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

我认为这行代码的功能是从某个地方调用价格,在帮助部分调用结帐并返回它。我的问题是如何访问那里。

非常感谢。

更新 1: 在 aton 给了我一些提示后,我做了一些研究,然后我深入到文件 DATA.php 并找到了他提到的函数:

public function formatPrice($price)
{
    return $this->getQuote()->getStore()->formatPrice($price);
}

但是有什么方法可以更深入地了解$this->getQuote()->getStore()->formatPrice($price);

再次感谢。

【问题讨论】:

    标签: javascript php html ajax magento


    【解决方案1】:

    在您上面提到的代码中,价格来自$_item->getCalculationPrice()

    代码

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

    只需获取价格和格式,即根据您的商店和其他内容添加货币符号。

    如果您想知道 formatPrice 函数在哪里,请导航到

    app/code/core/Mage/checkout/Helper/Data.php

    在这里您将看到该函数的定义。

    希望这会有所帮助。

    【讨论】:

    • 再次感谢您,我不知道该怎么报答您,我的好先生。
    猜你喜欢
    • 2015-08-09
    • 1970-01-01
    • 1970-01-01
    • 2013-01-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多