What is the layout for editing the “Your search returned no results.” page?Redirect to cms page if searched product is not foundThe new url key is not working for product pageApache SetEnfIf and fullpage cache: Start page shows the same store view for all URLs, once cachedOverride empty.xml in a custom themeWhat are the rest api's for the Magento2 modules

Can we compute the area of a quadrilateral with one right angle when we only know the lengths of any three sides?

In 'Revenger,' what does 'cove' come from?

What do you call someone who asks many questions?

Mathematica command that allows it to read my intentions

Dreadful Dastardly Diseases, or Always Atrocious Ailments

What reasons are there for a Capitalist to oppose a 100% inheritance tax?

Is it possible to create a QR code using text?

ssTTsSTtRrriinInnnnNNNIiinngg

I would say: "You are another teacher", but she is a woman and I am a man

What killed these X2 caps?

One verb to replace 'be a member of' a club

Arrow those variables!

GFCI outlets - can they be repaired? Are they really needed at the end of a circuit?

What exploit are these user agents trying to use?

Forgetting the musical notes while performing in concert

How can saying a song's name be a copyright violation?

Unlock My Phone! February 2018

Why is this clock signal connected to a capacitor to gnd?

How can I determine if the org that I'm currently connected to is a scratch org?

What about the virus in 12 Monkeys?

Is it inappropriate for a student to attend their mentor's dissertation defense?

What is a romance in Latin?

Examples of smooth manifolds admitting inbetween one and a continuum of complex structures

Do UK voters know if their MP will be the Speaker of the House?



What is the layout for editing the “Your search returned no results.” page?


Redirect to cms page if searched product is not foundThe new url key is not working for product pageApache SetEnfIf and fullpage cache: Start page shows the same store view for all URLs, once cachedOverride empty.xml in a custom themeWhat are the rest api's for the Magento2 modules













1















Instead of showing "Your search returned no results." I would like to give the user some links to other pages in the site. When I look in module-catalog-search/view/frontend/layout I see three files but they apply to all search results. Is there an easy way to do this with a layout or template file or do I have to build a module?










share|improve this question




























    1















    Instead of showing "Your search returned no results." I would like to give the user some links to other pages in the site. When I look in module-catalog-search/view/frontend/layout I see three files but they apply to all search results. Is there an easy way to do this with a layout or template file or do I have to build a module?










    share|improve this question


























      1












      1








      1








      Instead of showing "Your search returned no results." I would like to give the user some links to other pages in the site. When I look in module-catalog-search/view/frontend/layout I see three files but they apply to all search results. Is there an easy way to do this with a layout or template file or do I have to build a module?










      share|improve this question
















      Instead of showing "Your search returned no results." I would like to give the user some links to other pages in the site. When I look in module-catalog-search/view/frontend/layout I see three files but they apply to all search results. Is there an easy way to do this with a layout or template file or do I have to build a module?







      magento2.2.6






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 11 at 14:43







      tjjen

















      asked Mar 7 at 21:51









      tjjentjjen

      318117




      318117




















          2 Answers
          2






          active

          oldest

          votes


















          0














          There are 2 templates being used for result, one for simple search ( using top search field ) and other is for advance search field :




          For Top search field result :




          module_catalog-search/view/frontend/templates/result.phtml




          For Advance Search result :




          module_catalog-search/view/frontend/templates/advanced/result.phtml



          And both search fields search data / record within product catalog, override the template(s), and add your condition in that template to show whatever data you want to show if there is no record is returned.



          search for $block->getResultCount() and use this for condition.






          share|improve this answer























          • Can I just make changes to the template or do I need to make a module like this- magento.stackexchange.com/questions/211635/…

            – tjjen
            Mar 8 at 16:28











          • @tjjen, in your case i don't recommend developing module, you just need to add pages link to cms pages. so just add static cms pages links in case $block-getResultCount() < 1 or empty.

            – Naveed Asim
            Mar 8 at 17:00


















          0














          You have to redirect from "Your search returned no results." to "other page". You can override result.phtml to your theme.



          And setRedirect link as you want to redirect appropriate page. I have redirect to contact page when result page is "Your search returned no results." You can change as you want.




          File path:
          magento/app/design/frontend/Namespace/Theme/Magento_CatalogSearch/templates/result.phtml




          <?php

          <?php if ($block->getResultCount()): ?>
          <?= $block->getChildHtml('tagged_product_list_rss_link') ?>
          <div class="search results">
          <?php if ($messages = $block->getNoteMessages()):?>
          <div class="message notice">
          <div>
          <?php foreach ($messages as $message):?>
          <?= /* @escapeNotVerified */ $message ?><br />
          <?php endforeach;?>
          </div>
          </div>
          <?php endif; ?>
          <?= $block->getProductListHtml() ?>
          </div>
          <?php else: ?>

          <div class="message notice">
          <div>
          <?php
          $objectManager = MagentoFrameworkAppObjectManager::getInstance();
          $redirect = $objectManager->get('MagentoFrameworkAppResponseHttp');
          $redirect->setRedirect($this->getUrl('contact'));
          ?>

          </div>
          </div>
          <?php endif; ?>


          Let me know if any query.



          Hope it help!





          share























            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%2f264923%2fwhat-is-the-layout-for-editing-the-your-search-returned-no-results-page%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            There are 2 templates being used for result, one for simple search ( using top search field ) and other is for advance search field :




            For Top search field result :




            module_catalog-search/view/frontend/templates/result.phtml




            For Advance Search result :




            module_catalog-search/view/frontend/templates/advanced/result.phtml



            And both search fields search data / record within product catalog, override the template(s), and add your condition in that template to show whatever data you want to show if there is no record is returned.



            search for $block->getResultCount() and use this for condition.






            share|improve this answer























            • Can I just make changes to the template or do I need to make a module like this- magento.stackexchange.com/questions/211635/…

              – tjjen
              Mar 8 at 16:28











            • @tjjen, in your case i don't recommend developing module, you just need to add pages link to cms pages. so just add static cms pages links in case $block-getResultCount() < 1 or empty.

              – Naveed Asim
              Mar 8 at 17:00















            0














            There are 2 templates being used for result, one for simple search ( using top search field ) and other is for advance search field :




            For Top search field result :




            module_catalog-search/view/frontend/templates/result.phtml




            For Advance Search result :




            module_catalog-search/view/frontend/templates/advanced/result.phtml



            And both search fields search data / record within product catalog, override the template(s), and add your condition in that template to show whatever data you want to show if there is no record is returned.



            search for $block->getResultCount() and use this for condition.






            share|improve this answer























            • Can I just make changes to the template or do I need to make a module like this- magento.stackexchange.com/questions/211635/…

              – tjjen
              Mar 8 at 16:28











            • @tjjen, in your case i don't recommend developing module, you just need to add pages link to cms pages. so just add static cms pages links in case $block-getResultCount() < 1 or empty.

              – Naveed Asim
              Mar 8 at 17:00













            0












            0








            0







            There are 2 templates being used for result, one for simple search ( using top search field ) and other is for advance search field :




            For Top search field result :




            module_catalog-search/view/frontend/templates/result.phtml




            For Advance Search result :




            module_catalog-search/view/frontend/templates/advanced/result.phtml



            And both search fields search data / record within product catalog, override the template(s), and add your condition in that template to show whatever data you want to show if there is no record is returned.



            search for $block->getResultCount() and use this for condition.






            share|improve this answer













            There are 2 templates being used for result, one for simple search ( using top search field ) and other is for advance search field :




            For Top search field result :




            module_catalog-search/view/frontend/templates/result.phtml




            For Advance Search result :




            module_catalog-search/view/frontend/templates/advanced/result.phtml



            And both search fields search data / record within product catalog, override the template(s), and add your condition in that template to show whatever data you want to show if there is no record is returned.



            search for $block->getResultCount() and use this for condition.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 8 at 1:18









            Naveed AsimNaveed Asim

            2,7442317




            2,7442317












            • Can I just make changes to the template or do I need to make a module like this- magento.stackexchange.com/questions/211635/…

              – tjjen
              Mar 8 at 16:28











            • @tjjen, in your case i don't recommend developing module, you just need to add pages link to cms pages. so just add static cms pages links in case $block-getResultCount() < 1 or empty.

              – Naveed Asim
              Mar 8 at 17:00

















            • Can I just make changes to the template or do I need to make a module like this- magento.stackexchange.com/questions/211635/…

              – tjjen
              Mar 8 at 16:28











            • @tjjen, in your case i don't recommend developing module, you just need to add pages link to cms pages. so just add static cms pages links in case $block-getResultCount() < 1 or empty.

              – Naveed Asim
              Mar 8 at 17:00
















            Can I just make changes to the template or do I need to make a module like this- magento.stackexchange.com/questions/211635/…

            – tjjen
            Mar 8 at 16:28





            Can I just make changes to the template or do I need to make a module like this- magento.stackexchange.com/questions/211635/…

            – tjjen
            Mar 8 at 16:28













            @tjjen, in your case i don't recommend developing module, you just need to add pages link to cms pages. so just add static cms pages links in case $block-getResultCount() < 1 or empty.

            – Naveed Asim
            Mar 8 at 17:00





            @tjjen, in your case i don't recommend developing module, you just need to add pages link to cms pages. so just add static cms pages links in case $block-getResultCount() < 1 or empty.

            – Naveed Asim
            Mar 8 at 17:00













            0














            You have to redirect from "Your search returned no results." to "other page". You can override result.phtml to your theme.



            And setRedirect link as you want to redirect appropriate page. I have redirect to contact page when result page is "Your search returned no results." You can change as you want.




            File path:
            magento/app/design/frontend/Namespace/Theme/Magento_CatalogSearch/templates/result.phtml




            <?php

            <?php if ($block->getResultCount()): ?>
            <?= $block->getChildHtml('tagged_product_list_rss_link') ?>
            <div class="search results">
            <?php if ($messages = $block->getNoteMessages()):?>
            <div class="message notice">
            <div>
            <?php foreach ($messages as $message):?>
            <?= /* @escapeNotVerified */ $message ?><br />
            <?php endforeach;?>
            </div>
            </div>
            <?php endif; ?>
            <?= $block->getProductListHtml() ?>
            </div>
            <?php else: ?>

            <div class="message notice">
            <div>
            <?php
            $objectManager = MagentoFrameworkAppObjectManager::getInstance();
            $redirect = $objectManager->get('MagentoFrameworkAppResponseHttp');
            $redirect->setRedirect($this->getUrl('contact'));
            ?>

            </div>
            </div>
            <?php endif; ?>


            Let me know if any query.



            Hope it help!





            share



























              0














              You have to redirect from "Your search returned no results." to "other page". You can override result.phtml to your theme.



              And setRedirect link as you want to redirect appropriate page. I have redirect to contact page when result page is "Your search returned no results." You can change as you want.




              File path:
              magento/app/design/frontend/Namespace/Theme/Magento_CatalogSearch/templates/result.phtml




              <?php

              <?php if ($block->getResultCount()): ?>
              <?= $block->getChildHtml('tagged_product_list_rss_link') ?>
              <div class="search results">
              <?php if ($messages = $block->getNoteMessages()):?>
              <div class="message notice">
              <div>
              <?php foreach ($messages as $message):?>
              <?= /* @escapeNotVerified */ $message ?><br />
              <?php endforeach;?>
              </div>
              </div>
              <?php endif; ?>
              <?= $block->getProductListHtml() ?>
              </div>
              <?php else: ?>

              <div class="message notice">
              <div>
              <?php
              $objectManager = MagentoFrameworkAppObjectManager::getInstance();
              $redirect = $objectManager->get('MagentoFrameworkAppResponseHttp');
              $redirect->setRedirect($this->getUrl('contact'));
              ?>

              </div>
              </div>
              <?php endif; ?>


              Let me know if any query.



              Hope it help!





              share

























                0












                0








                0







                You have to redirect from "Your search returned no results." to "other page". You can override result.phtml to your theme.



                And setRedirect link as you want to redirect appropriate page. I have redirect to contact page when result page is "Your search returned no results." You can change as you want.




                File path:
                magento/app/design/frontend/Namespace/Theme/Magento_CatalogSearch/templates/result.phtml




                <?php

                <?php if ($block->getResultCount()): ?>
                <?= $block->getChildHtml('tagged_product_list_rss_link') ?>
                <div class="search results">
                <?php if ($messages = $block->getNoteMessages()):?>
                <div class="message notice">
                <div>
                <?php foreach ($messages as $message):?>
                <?= /* @escapeNotVerified */ $message ?><br />
                <?php endforeach;?>
                </div>
                </div>
                <?php endif; ?>
                <?= $block->getProductListHtml() ?>
                </div>
                <?php else: ?>

                <div class="message notice">
                <div>
                <?php
                $objectManager = MagentoFrameworkAppObjectManager::getInstance();
                $redirect = $objectManager->get('MagentoFrameworkAppResponseHttp');
                $redirect->setRedirect($this->getUrl('contact'));
                ?>

                </div>
                </div>
                <?php endif; ?>


                Let me know if any query.



                Hope it help!





                share













                You have to redirect from "Your search returned no results." to "other page". You can override result.phtml to your theme.



                And setRedirect link as you want to redirect appropriate page. I have redirect to contact page when result page is "Your search returned no results." You can change as you want.




                File path:
                magento/app/design/frontend/Namespace/Theme/Magento_CatalogSearch/templates/result.phtml




                <?php

                <?php if ($block->getResultCount()): ?>
                <?= $block->getChildHtml('tagged_product_list_rss_link') ?>
                <div class="search results">
                <?php if ($messages = $block->getNoteMessages()):?>
                <div class="message notice">
                <div>
                <?php foreach ($messages as $message):?>
                <?= /* @escapeNotVerified */ $message ?><br />
                <?php endforeach;?>
                </div>
                </div>
                <?php endif; ?>
                <?= $block->getProductListHtml() ?>
                </div>
                <?php else: ?>

                <div class="message notice">
                <div>
                <?php
                $objectManager = MagentoFrameworkAppObjectManager::getInstance();
                $redirect = $objectManager->get('MagentoFrameworkAppResponseHttp');
                $redirect->setRedirect($this->getUrl('contact'));
                ?>

                </div>
                </div>
                <?php endif; ?>


                Let me know if any query.



                Hope it help!






                share











                share


                share










                answered 9 mins ago









                Kirti NariyaKirti Nariya

                1,063415




                1,063415



























                    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%2f264923%2fwhat-is-the-layout-for-editing-the-your-search-returned-no-results-page%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

                    Can not update quote_id field of “quote_item” table magento 2Magento 2.1 - We can't remove the item. (Shopping Cart doesnt allow us to remove items before becomes empty)Add value for custom quote item attribute using REST apiREST API endpoint v1/carts/cartId/items always returns error messageCorrect way to save entries to databaseHow to remove all associated quote objects of a customer completelyMagento 2 - Save value from custom input field to quote_itemGet quote_item data using quote id and product id filter in Magento 2How to set additional data to quote_item table from controller in Magento 2?What is the purpose of additional_data column in quote_item table in magento2Set Custom Price to Quote item magento2 from controller

                    How to solve knockout JS error in Magento 2 Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?(Magento2) knockout.js:3012 Uncaught ReferenceError: Unable to process bindingUnable to process binding Knockout.js magento 2Cannot read property `scopeLabel` of undefined on Product Detail PageCan't get Customer Data on frontend in Magento 2Magento2 Order Summary - unable to process bindingKO templates are not loading in Magento 2.1 applicationgetting knockout js error magento 2Product grid not load -— Unable to process binding Knockout.js magento 2Product form not loaded in magento2Uncaught ReferenceError: Unable to process binding “if: function()return (isShowLegend()) ” magento 2

                    Nissan Patrol Зміст Перше покоління — 4W60 (1951-1960) | Друге покоління — 60 series (1960-1980) | Третє покоління (1980–2002) | Четверте покоління — Y60 (1987–1998) | П'яте покоління — Y61 (1997–2013) | Шосте покоління — Y62 (2010- ) | Посилання | Зноски | Навігаційне менюОфіційний український сайтТест-драйв Nissan Patrol 2010 7-го поколінняNissan PatrolКак мы тестировали Nissan Patrol 2016рвиправивши або дописавши її