I have the following question:
Add the layerend navigation of a top category, all the filters of all underlying subcategories are shown. In top categories, we only want to show two filters: product type and brand
.
We experimented in view.phtml
based on other topics, but haven't found the exact result.
It would be great if you could point us towards the solution!
Best Answer
This is what I understood from your question. You want to remove category filter for your two top categories (for them,
isAnchor
is set toYes
) and keep all other filters as it is.To achieve this, most easiest solution is a category specific layout update via any of your layout update xml file. For example, your category id be
12
. Then add below code in yourlocal.xml
file.File :
app\design\frontend\[package]\[theme]\layout\local.xml
Here
CATEGORY_12
is a layout handle update which is specifically created for a category with an id 12. Inside that, we are basically removing category filter from layered navigation.Hope you get the idea.
EDIT
So you want to remove category filter and keep all other filters intact. To do that, I believe you need to rewrite the class
Mage_Catalog_Block_Layer_View
which you can find atapp/code/core/Mage/Catalog/Block/Layer/View.php
Use your category ids in
$excludeCategories
and you are good to go.