我在Magento中有模型重写的问题。有两个自定义模块,在第一个模块的config.xml中我重写了核心模型
<models>
<callforprice>
<class>Atwix_CallForPrice_Model</class>
</callforprice>
<catalog>
<rewrite>
<product>Atwix_CallForPrice_Model_Saleable</product>
</rewrite>
</catalog>
</models>
我也重写了核心块
<blocks>
<callforprice>
<class>Atwix_CallForPrice_Block</class>
</callforprice>
<catalog>
<rewrite>
<product_list>Atwix_CallForPrice_Block_Product_List</product_list>
</rewrite>
</catalog>
</blocks>
getAddToCartUrl是重写的功能,此功能更改“添加到购物车”按钮的URL。在这个模块中它工作正常。但是当我创建新的自定义模块并调用函数
时$collection = Mage::getModel('catalog/product')->getCollection();
我没有得到按钮的URL。似乎重写似乎不起作用。 Button仍然有核心的URL。我知道这是因为我在Atwix_CallForPrice_Block_Product_List中解析了错误以确保,并且在第一个模块的情况下我得到了错误,在另一个案例中一切正常。
对不起我的英语,伙计们。
答案 0 :(得分:0)
我不确定,但也许您需要重写产品集合类。