I have one category in system... For example EMT. There are many products assigned to it. Now I want to filter some products for particular customers for that category. I mean only specific products should be display in that category for some customers. It should display all the products to guest users.

How can I do that so all the collection should filter with proper layered navigation and toolbar collection.

Can anyone suggest the way to do this with files I need to override?

enter image description here

  • you have pre list of product to show to customer ? – Minesh Patel Nov 2 '17 at 7:42
  • you can use event catalog_block_product_list_collection to filter you products – Minesh Patel Nov 2 '17 at 7:45
  • @RaphaelatDigitalPianism can you help on this? – Jagdish Barot Nov 3 '17 at 6:50

I assume you know how to write a plugin and how to write a script in Magento 2. With this in mind, the plan to have your issue resolved would be as follows:

  1. add a product attribute that is a boolean and define for all your products whether they can be displayed to guests or not —> make it layered enabled

  2. update all your products in your catalog with a script

  3. in the block \Magento\Catalog\Block\Product\ListProduct, you may change the function that loads the products using a plugin on the function getLoadedProductCollection

  • wrong product count in layernavigation. – Jagdish Barot Oct 16 '18 at 7:56

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.