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

What do you call someone who asks many questions?

How do I handle a potential work/personal life conflict as the manager of one of my friends?

Is the myth that if you can play one instrument, you can learn another instrument with ease true?

Can a virus destroy the BIOS of a modern computer?

What about the virus in 12 Monkeys?

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

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

A category-like structure without composition?

Is there a hemisphere-neutral way of specifying a season?

Unlock My Phone! February 2018

Are there any examples of a variable being normally distributed that is *not* due to the Central Limit Theorem?

Do scales need to be in alphabetical order?

Forgetting the musical notes while performing in concert

A friend helped me with a presentation – plagiarism or not?

How do I gain back my faith in my PhD degree?

How can I prevent hyper evolved versions of regular creatures from wiping out their cousins?

Short story with a alien planet, government officials must wear exploding medallions

Is there an expression that means doing something right before you will need it rather than doing it in case you might need it?

Intersection Puzzle

What is the most common color to indicate the input-field is disabled?

How dangerous is XSS?

If human space travel is limited by the G force vulnerability, is there a way to counter G forces?

Dreadful Dastardly Diseases, or Always Atrocious Ailments

What is a romance in Latin?



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|improve this answer























            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|improve this answer



























              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|improve this answer

























                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|improve this answer













                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|improve this answer












                share|improve this answer



                share|improve this answer










                answered 19 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

                    Disable / Remove link to Product Items in Cart 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?How can I limit products that can be bought / added to cart?Remove item from cartHide “Add to Cart” button if specific products are already in cart“Prettifying” the custom options in cart pageCreate link in cart sidebar to view all added items After limit reachedLink products together in checkout/cartHow to Get product from cart and add it againHide action-edit on cart page if simple productRemoving Cart items - ObserverRemove wishlist items when added to cart

                    Helsingin valtaus Sisällysluettelo Taustaa | Yleistä sotatoimista | Osapuolet | Taistelut Helsingin ympäristössä | Punaisten antautumissuunnitelma | Taistelujen kulku Helsingissä | Valtauksen jälkeen | Tappiot | Muistaminen | Kirjallisuutta | Lähteet | Aiheesta muualla | NavigointivalikkoTeoksen verkkoversioTeoksen verkkoversioGoogle BooksSisällissota Helsingissä päättyi tasan 95 vuotta sittenSaksalaisten ylivoima jyräsi punaisen HelsinginSuomalaiset kuvaavat sotien jälkiä kaupungeissa – katso kuvat ja tarinat tutuilta kulmiltaHelsingin valtaus 90 vuotta sittenSaksalaiset valtasivat HelsinginHyökkäys HelsinkiinHelsingin valtaus 12.–13.4. 1918Saksalaiset käyttivät ihmiskilpiä Helsingin valtauksessa 1918Teoksen verkkoversioTeoksen verkkoversioSaksalaiset hyökkäävät Etelä-SuomeenTaistelut LeppävaarassaSotilaat ja taistelutLeppävaara 1918 huhtikuussa. KapinatarinaHelsingin taistelut 1918Saksalaisten voitonparaati HelsingissäHelsingin valtausta juhlittiinSaksalaisten Helsinki vuonna 1918Helsingin taistelussa kaatuneet valkokaartilaisetHelsinkiin haudatut taisteluissa kaatuneet punaiset12.4.1918 Helsingin valtauksessa saksalaiset apujoukot vapauttavat kaupunginVapaussodan muistomerkkejä Helsingissä ja pääkaupunkiseudullaCrescendo / Vuoden 1918 Kansalaissodan uhrien muistomerkkim

                    Adjektiivitarina Tarinan tekeminen | Esimerkki: ennen | Esimerkki: jälkeen | Navigointivalikko