cancel
Showing results for 
Search instead for 
Did you mean: 

How to Hide child category product from category product listing if parent category is anchored M2.3

How to Hide child category product from category product listing if parent category is anchored M2.3

Hi,

I need to implement a custom functionality, so that anchored category should not display the child category products on category listing page in frontend.

By default all the anchored category shows the child products automatically. I need to override this functionality.

 

Can anyone help how can I do this customization? Which class or function need to override. I am new to Magento and  tried to explore magento catalog module but not able to get that which function or class need to use.

 

Looking for some valuable response.

Thanks

2 REPLIES 2

Re: How to Hide child category product from category product listing if parent category is anchored

Hi,
Somehow I found that which class is responsible and need to override the function.

So, I found that the function addCategoryFilter() in Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection is responsible for this in Magento 2.4.2

I tried to override this using my custom module using preference but not able to override Fulltext/Collection.

Can anyone help and suggest how to override this?

Re: How to Hide child category product from category product listing if parent category is anchored


@tuktukange0fe6 wrote:

Hi,
Somehow I found that which class is responsible and need to override the function.

So, I found that the function addCategoryFilter() in Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection is responsible for this in Magento 2.4.2

I tried to override this using my custom module using preference but not able to override Fulltext/Collection.

Can anyone help and suggest how to override this?


Thanks for the information, I will try to figure it out for more. Keep sharing such informative post.