0

I am editing the file \app\design\frontend\base\default\template\catalog\product\list\toolbar.phtml through my own module. I want to specify the available categories on the current list.

Example: I search for "shirt" and the products that contains "shirt" is in 2 categories: summer and winter.

The idea is that the user can filter by (not order by) one of the two categories available. I searched this function:

<?php foreach ($this->getAvailableLimit() as  $_key=>$_limit): ?> 

I found out that it only works with specific attributes of product and only for "order by", but what about the categories? and if I want to "filter by"?

Is that possible? Any ideas?

Thanks!

I response to myself:

I do it!

On the one hand I copied the file toolbar.php to override it (and add my personalized functions) and secondly the List.php file to edit the collection list and add my category_id filter. Finally I edited my toolbar.phtml file to add the dropdown list with available categories and get the categoryId param to keep selected the category in the dropdown.

1 Answer 1

1

You can make categories filterable in the layered navigation. In the admin, if you set the category setting "Is Anchor?", that category will become a filterable attribute. This way you don't have customize it in the toolbar filters.

1
  • I don't need the default filter layered navigation, because in the template that we are using is deactivated. Thanks for your answer anyway. Feb 11, 2015 at 22:18

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.