Magento重写getPrice() [英] Magento Override getPrice()

查看:101
本文介绍了Magento重写getPrice()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过覆盖"Mage_Catalog_Model_Product_Type_Price"类中的getPrice()方法来覆盖Magento产品的价格规则,简单的产品可以正常工作,并显示我在getPrice()中提到的更新价格,即

I have overrode the price rule of Magento product by overriding the getPrice() method in "Mage_Catalog_Model_Product_Type_Price" class, simple products are working fine and show the updated price which I mentioned in getPrice() i.e

    public function getPrice($product)
    {
      return 80;
    }

但是对于可下载的产品,它会显示原始价格, 这里的任何人都可以告诉我如何在可下载产品中忽略价格.

But in the case of downloadable products it shows the original price, Any one here can tell me how can I override price in downloadable products.

谢谢

推荐答案

我猜想这将被追究到Mage_Downloadable_Model_Product_Price的getFinalPrice方法.尝试编辑文件以返回晦涩的固定金额,然后查看是否就是您所获得的价值.如果是,那么您也将需要重载此模型.

I would guess that this will be chased down to the getFinalPrice method of Mage_Downloadable_Model_Product_Price. Trying editing the file to return an obscure fixed amount and see if that's the value you get. If it is then you will need to overload this model too.

这篇关于Magento重写getPrice()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆