0

I had added a category dropdown in form.mini.phtml file and submitted the search form. I tried modifying the collection of the list.phtml file which is in Magento_Catalog module but hard luck. Kindly advice how to filter the search result product collection using the category id.

  • hae you tried funtion addFeildToFilter('feild',$value) of magento category Collection – Waqar Ali Oct 30 '19 at 6:34
  • I have tried it in list.phtml for $block->getLoadedProductCollection(); but not working. – Rising Oct 30 '19 at 7:17
0

You can try (Magento 2.3)

addCategoryFilter($category)

on collection

Please refer below path

vendor/magento/module-catalog-search/Model/ResourceModel/Advanced/Collection.php
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.