0
votes

I know someone asked similar question before. But my question is a bit different.

I know if I set the main category to Anchor. And set simple products' category only to the sub-categories. I could have what I needed. But, big but, I would lose the Layered Navigation for the main category.

How can I keep the keep the layered navigation for the main category, but only show simply products to the sub-categories?

1

1 Answers

0
votes

Extend Mage_Catalog_Block_Product_List _getProductCollection() so that:
IF you are on a category page AND it is level 2 you add a filter to show only configurable products.
IF you are on a category page AND it is > level 2 you add a filter to show only simple products.

if ($category = Mage::registry('current_category')) will determine if you are on a category page or not and get the category

$level = $category->getLevel() will get the category level

$this->_productCollection->addAttributeToFilter('type_id', array('eq' => 'simple')) will filter the collection to allow only simple products to be shown

Extend the block by either rewriting the block or changing the layout and referencing your custom one that extends the one mentioned above