I'm working on a module where some products have an attribute named designer. and for every designer, all products by him displayed as catalog category view. So far I'm able to filter the products collection by designer attribute and successfully display them as the catalog category view page.

But now the problem is, I need to display a layered navigation for those product which may be filtered by price and all.

Is there a way that I could add layered navigation in that filtered product collection?


2 Answers 2


Mohammad found an answer on StackOverflow which has since been deleted. Here is that answer:

Finally I found the solution for custom Layered navigation for custom product collection. Here are the changes what I have did to sort-out this issue.

1. Created one custom module for custom page. My custom page URL was http://{magento_root}/onsale

2. Set below Layout XML file for my custom page layout (onsale is my custom attribute)

<onsale_index_index translate="label">
    <reference name="left">
       <block type="onsale/layer_view" name="customlayer" after="currency" template="catalog/layer/view.phtml"/>
    <reference name="content">
        <block type="core/template" name="category.products" template="onsale/category/view.phtml">
            <block type="onsale/product_list" name="product_list" template="catalog/product/list.phtml">

                <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
                    <block type="page/html_pager" name="product_list_toolbar_pager"/>
                <action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
                <action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
                <action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
                <action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
                <action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
                <action method="setToolbarBlockName"><name>product_list_toolbar</name></action>

3. In onsale/category/view.phtml I have just set page title & called product listing $this->getChildHtml('product_list');.

4. Now I have three block file, a) onsale, b) product_list, c) layer_view.

a) Mymodule_Onsale_Block_Onsale extends Mage_Core_Block_Template and it has just two method one for _prepareLayout & for _prepareLayout.

b) Mymodule_Onsale_Block_Product_List extends Mage_Catalog_Block_Product_List and it has just one method which is as below:

protected function _getProductCollection()

   if (is_null($this->_productCollection)) 
        $layer = $this->getLayer();
        $productCollection = $layer->getProductCollection();
        $this->_productCollection = $productCollection;
    return $this->_productCollection;

c) layer_view block has one method getLayer() as below:

public function getLayer()
    return Mage::getSingleton('onsale/layer');

5. No changes in controller, just call to Layout & Render.

6. Now for model file. I have just one model file for layer with getProductCollection method as below which extend to Mage_Catalog_Model_Layer.

class name Mymodule_Onsale_Model_Layer extends Mage_Catalog_Model_Layer

  public function getProductCollection()

    if (isset($this->_productCollections[$this->getCurrentCategory()->getId()])) {
        $collection = $this->_productCollections[$this->getCurrentCategory()->getId()];
    } else {

        $collection = Mage::getResourceModel('catalog/product_collection')->addAttributeToSelect('*');

        $this->_productCollections[$this->getCurrentCategory()->getId()] = $collection;
    return $collection;

7. One last important, Please set No to Use Flat Catalog Category & Use Flat Catalog Product at System -> configuration -> Catalog -> fontend.

It show me correct product listing with layered navigation.

  • is 4 a) correct? Also, what if one cannot set "use flat catalog category" to 'yes'? Feb 17, 2015 at 21:15
  • I'm wondering about 4 a) also. Did you mean to say _construct and _prepareLayout or did you overwrite a different method than _construct? Jun 15, 2015 at 22:53

After digging a lot I'd found a working solution by Rakesh on stackoverflow.

I'd recently seen that the answer on the link no longer available.

  • 1
    Can you please recreate the answer here Feb 17, 2015 at 20:25
  • 1
    Answer was deleted. I'll post as a separate answer - Mohammad, feel free to grab the content and add it to your answer.
    – benmarks
    Feb 17, 2015 at 20:57

Your Answer

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

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