【问题标题】:Magento - override getPrice() not working in Category ViewMagento - 覆盖 getPrice() 在类别视图中不起作用
【发布时间】:2013-07-02 23:22:27
【问题描述】:

尝试在 Magento 中将所有价格乘以 1.15。

# /app/code/local/Mage/Catalog/Model/Product/Type/Price.php

public function getPrice($product)
    {
        return $product->getData('price') * 1.15;
    }

这适用于简单和分组产品的产品详细信息页面。

我的问题:为什么分类页面仍然显示每个产品的原始价格?

【问题讨论】:

    标签: magento


    【解决方案1】:

    我认为这不是正确的做法。您是否只想在前端将价格显示为原始价格的 1.15 倍?

    在不完全理解您的意图的情况下回答您的问题 - 我建议改为在您的主题目录中编辑 PHTML 文件。查找文件product.phtmllist.phtmlconfigurable.phtmlgrouped.phtml

    实际上,更好的方法可能是覆盖catalog/product/price.phtml - 这个模板在前端处理所有价格。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-26
    • 2013-02-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多