Magento – How to modify “shop by” to display category

layered-navigation

I'm trying to get the shop by filters to display a new section called category. I managed to edit template/category/layer/view.phtml to get it to display the category section but the subcategories display all the options including subcategories, subsubcategories, and so on. I only want to display the categories that are one level higher than the main category. Sort of what it looks like in a dropdown navigation menu. I've also tried several coding strategies inside template/category/layer/filter.phtml. I've gotten close but managed to mess up the main navigation in the process.

The category filter needs to work for all product selections from the main menu, so I don't want to modify all 1800 products to add a field that contains the parent category. I've gotten so close to getting it to work but I have problems using getLevel, and getID on certain variables.

Best Answer

Categories in layered navigation do not work like attributes and are not 'filterable' - and as such we usually recommend setting up a dropdown or multiselect attribute type to apply to products so that you can provide filtering of this level.

It's not "sexy" and it's not a code-based solution, but it gets the job done.

Related Topic