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

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

          Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

          Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?