I have loaded a custom template in the category view page. with content all categories in the drop down.

I am looking for functionality once drop down changes the corresponding category products should load in the list page.

Example: I have the drop down like below in list page before toolbar.

Test Category

  • test1
  • test2
  • test3

Once test2 category selected from the dropdown, All products belongs to that category should load in the content section of list page.

Is something like that can be achieved?

Please, anyone, look into it and update your thoughts. Thanks

2 Answers 2


What you are trying to do is build-in with Magento.

You need to setup the category to anchor, and refresh the indexes.

php bin/magento indexer:reindex

When browsing to the category, you should see the left column with layered navigation filters and if this category has sub categories, these would appear in a layered filter and clicking on either of these categories would refresh the product listing

of course, the category layer filter can be changed to accomodate a dropdown, does this work?

  • hi @Herve, Yes its a default magento feature, but i have loaded a custom page before the toolbar, with dropdown of all the current category child categories, Once dropdown changes , can we apply filter in that way? Jan 2, 2019 at 11:17

Rough steps to accomplish this functionality.

  1. On the drop-down change event, send an AJAX request to a custom controller action. This request should contain the selected category ID.
  2. In your custom controller action, get the products collection based on the category ID. For abstraction, you can create a custom helper function to get the products collection and call the function from the controller.
  3. Whatever the response is for products collection, return it back to the PHTML file from where you started in the first step.
  4. Take the response and decorate it as per your needs.
  • hi @Mohit, this step will clear the filters on left navigation, can we reload the collection with selected category? Jan 3, 2019 at 14:24

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.