Magento layered navigation on custom product collection

流过昼夜 提交于 2019-11-28 21:26:35

I just managed to achieve what I wanted. I have overwritten both the Mage_Catalog_Model_Layer class and the Mage_Catalog_Model_Category

Both now have a new variable called $_customCollection: protected $_customProductCollection;

I have overwritten the getProductCollection() in both classes and I added this in the beginning of the method:

if(isset($this->_customProductCollection)){
        return $this->_customProductCollection;
    }

I have also a method that allows me to set this "customProductCollection" inside both these classes. Once It's set, the rest of the data of the layered navigation/category is based on this collection.

;)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!