I am writing a block which subclasses Mage_Catalog_Block_Layer_Filter_Category to display a list of products in each category. To do this I apply addCategoryFilter() to the layer product collection for each layer filter item, first using clear() to remove any other filters. So I end up with $this->getLayer()->getProductCollection()->clear()->addCategoryFilter($category) for each item.

The problem is the last-displayed category filter is not being cleared before the rest of the page renders. So the sidebar layered navigation is still filtered by it. How can I clear it?? I have tried doing $this->getLayer()->getProductCollection->clear() in _afterToHtml() but with no luck. Any help much appreciated.

2 Answers 2


The problem is getLayer is a singleton and holds afaik one collection. There is no easy way to achieve what you want. You can unset the whole collection (maybe) after doing whatever you are doing (which I didnt understand)


Try this before you taking the collection from layer


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.