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

                    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

                    Magento 2 disable Secret Key on URL's from terminal The Next CEO of Stack OverflowMagento 2 Shortcut/GUI tool to perform commandline tasks for windowsIn menu add configuration linkMagento oAuth : Generating access token and access secretMagento 2 security key issue in Third-Party API redirect URIPublic actions in admin controllersHow to Disable Cache in Custom WidgetURL Key not changing in Magento 2Product URL Key gets deleted when importing custom options - Magento 2Problem with reindex terminalMagento 2 - bin/magento Commands not working in Cpanel Terminal

                    Aasi (pallopeli) Navigointivalikko