Magento 2 how to filter product collection on category page with custom filters The 2019 Stack Overflow Developer Survey Results Are In Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar ManaraCustom category collection not rendering correct results in layered navigation and toolbar in magento 2Filter magento product collection by category id but NOT category childrenMagento 2 Product Collection with Multi Categories Layered NavigationRemove Category filter from Shop By Filter Renderer in Magento 2Magento 2 : Static blocks with products on category landing pageMagento-2 How to get custom product collection in catalog search result based on particular categoryMagento-2 How to change product collection based on categoriesHow to apply visibility filter to category view's product collection in magento 2?How to get current category price range filter list in Magento2Filter on custom product collection

Keeping a retro style to sci-fi spaceships?

Solving overdetermined system by QR decomposition

Can I visit the Trinity College (Cambridge) library and see some of their rare books

Why can't devices on different VLANs, but on the same subnet, communicate?

How to make Illustrator type tool selection automatically adapt with text length

Working through the single responsibility principle (SRP) in Python when calls are expensive

Why doesn't a hydraulic lever violate conservation of energy?

Deal with toxic manager when you can't quit

"... to apply for a visa" or "... and applied for a visa"?

How do you keep chess fun when your opponent constantly beats you?

What aspect of planet Earth must be changed to prevent the industrial revolution?

What do I do when my TA workload is more than expected?

How to read αἱμύλιος or when to aspirate

Why did Peik Lin say, "I'm not an animal"?

For what reasons would an animal species NOT cross a *horizontal* land bridge?

Can the Right Ascension and Argument of Perigee of a spacecraft's orbit keep varying by themselves with time?

What's the point in a preamp?

ELI5: Why do they say that Israel would have been the fourth country to land a spacecraft on the Moon and why do they call it low cost?

Did the new image of black hole confirm the general theory of relativity?

Variable with quotation marks "$()"

Using dividends to reduce short term capital gains?

Define a list range inside a list

Can we generate random numbers using irrational numbers like π and e?

How to handle characters who are more educated than the author?



Magento 2 how to filter product collection on category page with custom filters



The 2019 Stack Overflow Developer Survey Results Are In
Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar ManaraCustom category collection not rendering correct results in layered navigation and toolbar in magento 2Filter magento product collection by category id but NOT category childrenMagento 2 Product Collection with Multi Categories Layered NavigationRemove Category filter from Shop By Filter Renderer in Magento 2Magento 2 : Static blocks with products on category landing pageMagento-2 How to get custom product collection in catalog search result based on particular categoryMagento-2 How to change product collection based on categoriesHow to apply visibility filter to category view's product collection in magento 2?How to get current category price range filter list in Magento2Filter on custom product collection



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








7















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










share|improve this question






















  • 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

















7















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










share|improve this question






















  • 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













7












7








7


2






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










share|improve this question














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







magento2 category category-products






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 2 '17 at 7:09









Jagdish BarotJagdish Barot

1149




1149












  • 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

















  • 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
















you have pre list of product to show to customer ?

– Minesh Patel
Nov 2 '17 at 7:42





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






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





@RaphaelatDigitalPianism can you help on this?

– Jagdish Barot
Nov 3 '17 at 6:50










1 Answer
1






active

oldest

votes


















0














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 MagentoCatalogBlockProductListProduct, you may change the function that loads the products using a plugin on the function getLoadedProductCollection






share|improve this answer

























  • wrong product count in layernavigation.

    – Jagdish Barot
    Oct 16 '18 at 7:56












Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f199729%2fmagento-2-how-to-filter-product-collection-on-category-page-with-custom-filters%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














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 MagentoCatalogBlockProductListProduct, you may change the function that loads the products using a plugin on the function getLoadedProductCollection






share|improve this answer

























  • wrong product count in layernavigation.

    – Jagdish Barot
    Oct 16 '18 at 7:56
















0














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 MagentoCatalogBlockProductListProduct, you may change the function that loads the products using a plugin on the function getLoadedProductCollection






share|improve this answer

























  • wrong product count in layernavigation.

    – Jagdish Barot
    Oct 16 '18 at 7:56














0












0








0







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 MagentoCatalogBlockProductListProduct, you may change the function that loads the products using a plugin on the function getLoadedProductCollection






share|improve this answer















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 MagentoCatalogBlockProductListProduct, you may change the function that loads the products using a plugin on the function getLoadedProductCollection







share|improve this answer














share|improve this answer



share|improve this answer








edited Jun 14 '18 at 9:06









Rama Chandran M

2,74181530




2,74181530










answered Jun 14 '18 at 8:59









Herve TribouilloyHerve Tribouilloy

1,349510




1,349510












  • wrong product count in layernavigation.

    – Jagdish Barot
    Oct 16 '18 at 7:56


















  • wrong product count in layernavigation.

    – Jagdish Barot
    Oct 16 '18 at 7:56

















wrong product count in layernavigation.

– Jagdish Barot
Oct 16 '18 at 7:56






wrong product count in layernavigation.

– Jagdish Barot
Oct 16 '18 at 7:56


















draft saved

draft discarded
















































Thanks for contributing an answer to Magento Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f199729%2fmagento-2-how-to-filter-product-collection-on-category-page-with-custom-filters%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Bulk add to cart function issuecart vs. mini cart issue … rwd themeRedirect Add to cart button to cart pageAdd to cart issue - Magento 2.1The requested Payment Method is not available When creating an orderM2: reason add-to-cart might not function in production modeAdd to cart issue in some android devicesMagento 2 - custom price can not add to subtotal and grand total after add to cartAdd to cart codeIssue with my cart module on pdp and cart pages, just keeps spinningBulk price and quantity update using rest api

Magento2 - How to hide price filter only in specific categories?Multiselect price filter attribute in layered navigationhide only some categories from layered navigation in magentoRemove Price Filter on certain categoriescustomize layered price filter?Hide Price for a particular customer groupPrice filter in layered navigation not working correctly with price including tax in magento 2.2.3Magento 2 how to hide attribute at Layered navigation?Magento 2. how to hide price only for specific categoriesMagento 2 How can I hide the price and total from cart and checkout summary?Magento2: Can we add navigation layered filter like price filter for other attribute?