0

I would like to change the category product collection from the current category to the parent category?

I have created a custom category in which I would like to load the collection of the parent category

  • in-spite of $category->getProductCollection() try $category->getParentCategory()->getProductCollection(); – Yash Patadia Feb 14 at 10:14
  • Which file should I make change? – Arjun Feb 14 at 10:45
  • For which page you are doing the changes? – Yash Patadia Feb 14 at 11:24
  • I am working on the category page I need to load parent category products collection instead of current category in category listing page – Arjun Feb 14 at 11:46
  • I think its Magento/CatalogModel/Layer/Filter/Category line no 74, $this->getLayer()->getProductCollection()->addCategoryFilter($category); – Yash Patadia Feb 14 at 12:01

Your Answer

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

Browse other questions tagged or ask your own question.