Magento 1.7 How to use categories as filters?

640 views Asked by At

Sorry for my bad english.

I've tried to find, witouth success, how to use existing categories as filters. So it would let to filter products by all the categories they belong to.

Exemple, I've 3 categories : "brands", "sports" and "categories".

I have a baseball ball appearing in theses 3 categories.

In :

Brands --- my brand

Sport --- Baseball

Categories --- Balls

I would like that, for exemple, if I'm in "my brand" cat, I can filter by "balls", so that I can browse balls from this brand.

I know I can achieve this with attributes, but I don't like the way attributes are ordered, and I wish I could find a way to keep categories tree.

In fact, I want exactly the same filters that we have when we do a research (all categories, and attributes).

Thanks in advance for your helpful lights !

1

There are 1 answers

4
Kalpesh On

You can filter products by category with:

->addCategoryFilter($cat)

OR

->addAttributeToFilter('category_id', array('in' => $catIDs))