Magento layered navigation on custom product collection

后端 未结 1 556
[愿得一人]
[愿得一人] 2020-12-14 10:03

I have been working on a custom module for Magento (ver. 1.8.0.0) that shows a list of related products of a certain product.

In order to achieve this I have created

相关标签:
1条回答
  • 2020-12-14 10: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.

    ;)

    0 讨论(0)
提交回复
热议问题