Magento-2 How to get custom product collection in catalog search result based on particular categoryOn Search Result: Group Products by CategoryHow to exclude or include specific category in catalog search result?How to order search results by category?Include category in search resultSearch result in magentocatalog search product per page issueMagento-2 How to change product collection based on categoriesSearch product URL as catalog/view/id/213 Magento 2Magento2.3 - How to Sort Products Based on Attribute CategoryChange Magento 2 catalog search result

What to do when surprise and a high initiative roll conflict with the narrative?

Extreme flexible working hours: how to control people and activities?

Is it possible to have a wealthy country without a middle class?

Cascading Switches. Will it affect performance?

How can I end combat quickly when the outcome is inevitable?

What ways have you found to get edits from non-LaTeX users?

Need feedback - Can the composition/colors of this design be fixed if something is lacking or is not a better fit?

English word for "product of tinkering"

What can I, as a user, do about offensive reviews in App Store?

Is an entry level DSLR going to shoot nice portrait pictures?

Arriving at the same result with the opposite hypotheses

Pathfinder warbow concept review

How do I prevent employees from either switching to competitors or opening their own business?

Group Integers by Originality

How to tell your grandparent to not come to fetch you with their car?

Is this use of the expression "long past" correct?

Is it a problem if <h4>, <h5> and <h6> are smaller than regular text?

SQL counting distinct over partition

Using "subway" as name for London Underground?

What is the purpose of the goat for Azazel, as opposed to conventional offerings?

is it possible for a vehicle to be manufactured witout a catalitic converter

Giant Steps - Coltrane and Slonimsky

Why can't I use =default for default ctors with a member initializer list

Non-disclosure agreement in a small business



Magento-2 How to get custom product collection in catalog search result based on particular category


On Search Result: Group Products by CategoryHow to exclude or include specific category in catalog search result?How to order search results by category?Include category in search resultSearch result in magentocatalog search product per page issueMagento-2 How to change product collection based on categoriesSearch product URL as catalog/view/id/213 Magento 2Magento2.3 - How to Sort Products Based on Attribute CategoryChange Magento 2 catalog search result






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








1















I am working on custom module for catalog access. It requires only logged in customer to access the assigned category products.



Right now in catalog search result, product collection displays all the category products, but I need to display only selected category products.



See below Example



Suppose customer A has access to only categories Men > Tops > Tshirts. So, he will only see Men > Tops > Tshirts products in catalog search in magento 2. In search results only assigned categories products should display and not any other category products.










share|improve this question






























    1















    I am working on custom module for catalog access. It requires only logged in customer to access the assigned category products.



    Right now in catalog search result, product collection displays all the category products, but I need to display only selected category products.



    See below Example



    Suppose customer A has access to only categories Men > Tops > Tshirts. So, he will only see Men > Tops > Tshirts products in catalog search in magento 2. In search results only assigned categories products should display and not any other category products.










    share|improve this question


























      1












      1








      1








      I am working on custom module for catalog access. It requires only logged in customer to access the assigned category products.



      Right now in catalog search result, product collection displays all the category products, but I need to display only selected category products.



      See below Example



      Suppose customer A has access to only categories Men > Tops > Tshirts. So, he will only see Men > Tops > Tshirts products in catalog search in magento 2. In search results only assigned categories products should display and not any other category products.










      share|improve this question
















      I am working on custom module for catalog access. It requires only logged in customer to access the assigned category products.



      Right now in catalog search result, product collection displays all the category products, but I need to display only selected category products.



      See below Example



      Suppose customer A has access to only categories Men > Tops > Tshirts. So, he will only see Men > Tops > Tshirts products in catalog search in magento 2. In search results only assigned categories products should display and not any other category products.







      magento2 collection catalogsearch






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 1 '17 at 9:02







      Suresh Chikani

















      asked Aug 1 '17 at 5:47









      Suresh ChikaniSuresh Chikani

      10.5k53673




      10.5k53673




















          1 Answer
          1






          active

          oldest

          votes


















          0














          I had a similar requirement to restrict the access to products in search result based on some customer attribute.



          There are 2 classes responsible to filter and build the query for catalog search namely MagentoCatalogSearchModelSearchIndexBuilder and MagentoFrameworkSearchAdapterMysqlQueryBuilderMatch,
          You can add plugin/override to the methods IndexBuilder::build and the method MagentoFrameworkSearchAdapterMysqlQueryBuilderMatch::build to apply the required logic.






          share|improve this answer























          • I have checked but I can't see any category condition here, can you please give me some more ideas for categories access restriction.

            – Suresh Chikani
            Aug 1 '17 at 9:27











          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%2f187286%2fmagento-2-how-to-get-custom-product-collection-in-catalog-search-result-based-on%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 had a similar requirement to restrict the access to products in search result based on some customer attribute.



          There are 2 classes responsible to filter and build the query for catalog search namely MagentoCatalogSearchModelSearchIndexBuilder and MagentoFrameworkSearchAdapterMysqlQueryBuilderMatch,
          You can add plugin/override to the methods IndexBuilder::build and the method MagentoFrameworkSearchAdapterMysqlQueryBuilderMatch::build to apply the required logic.






          share|improve this answer























          • I have checked but I can't see any category condition here, can you please give me some more ideas for categories access restriction.

            – Suresh Chikani
            Aug 1 '17 at 9:27















          0














          I had a similar requirement to restrict the access to products in search result based on some customer attribute.



          There are 2 classes responsible to filter and build the query for catalog search namely MagentoCatalogSearchModelSearchIndexBuilder and MagentoFrameworkSearchAdapterMysqlQueryBuilderMatch,
          You can add plugin/override to the methods IndexBuilder::build and the method MagentoFrameworkSearchAdapterMysqlQueryBuilderMatch::build to apply the required logic.






          share|improve this answer























          • I have checked but I can't see any category condition here, can you please give me some more ideas for categories access restriction.

            – Suresh Chikani
            Aug 1 '17 at 9:27













          0












          0








          0







          I had a similar requirement to restrict the access to products in search result based on some customer attribute.



          There are 2 classes responsible to filter and build the query for catalog search namely MagentoCatalogSearchModelSearchIndexBuilder and MagentoFrameworkSearchAdapterMysqlQueryBuilderMatch,
          You can add plugin/override to the methods IndexBuilder::build and the method MagentoFrameworkSearchAdapterMysqlQueryBuilderMatch::build to apply the required logic.






          share|improve this answer













          I had a similar requirement to restrict the access to products in search result based on some customer attribute.



          There are 2 classes responsible to filter and build the query for catalog search namely MagentoCatalogSearchModelSearchIndexBuilder and MagentoFrameworkSearchAdapterMysqlQueryBuilderMatch,
          You can add plugin/override to the methods IndexBuilder::build and the method MagentoFrameworkSearchAdapterMysqlQueryBuilderMatch::build to apply the required logic.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Aug 1 '17 at 9:14









          Taral PatoliyaTaral Patoliya

          94621035




          94621035












          • I have checked but I can't see any category condition here, can you please give me some more ideas for categories access restriction.

            – Suresh Chikani
            Aug 1 '17 at 9:27

















          • I have checked but I can't see any category condition here, can you please give me some more ideas for categories access restriction.

            – Suresh Chikani
            Aug 1 '17 at 9:27
















          I have checked but I can't see any category condition here, can you please give me some more ideas for categories access restriction.

          – Suresh Chikani
          Aug 1 '17 at 9:27





          I have checked but I can't see any category condition here, can you please give me some more ideas for categories access restriction.

          – Suresh Chikani
          Aug 1 '17 at 9:27

















          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%2f187286%2fmagento-2-how-to-get-custom-product-collection-in-catalog-search-result-based-on%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

          Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

          Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

          Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form