Magento 2 how to filter product collection on category page with custom filtersCustom category collection not...

extract characters between two commas?

What do the Banks children have against barley water?

Patience, young "Padovan"

Does a dangling wire really electrocute me if I'm standing in water?

Is a vector space a subspace of itself?

"My colleague's body is amazing"

Is there a way to make member function NOT callable from constructor?

Why Is Death Allowed In the Matrix?

Can the Produce Flame cantrip be used to grapple, or as an unarmed strike, in the right circumstances?

Where to refill my bottle in India?

How could a lack of term limits lead to a "dictatorship?"

What is the command to reset a PC without deleting any files

How is it possible for user's password to be changed after storage was encrypted? (on OS X, Android)

Why was the "bread communication" in the arena of Catching Fire left out in the movie?

Can I legally use front facing blue light in the UK?

How would photo IDs work for shapeshifters?

Prime joint compound before latex paint?

How do I create uniquely male characters?

Was there ever an axiom rendered a theorem?

Are white and non-white police officers equally likely to kill black suspects?

Why do we use polarized capacitors?

Could a US political party gain complete control over the government by removing checks & balances?

New order #4: World

When blogging recipes, how can I support both readers who want the narrative/journey and ones who want the printer-friendly recipe?



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


Custom 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














bumped to the homepage by Community 6 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • 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














bumped to the homepage by Community 6 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • 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





bumped to the homepage by Community 6 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 6 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • 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

“%fieldName is a required field.”, in Magento2 REST API Call for GET Method Type The Next...

How to change City field to a dropdown in Checkout step Magento 2Magento 2 : How to change UI field(s)...

夢乃愛華...