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
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
add a comment |
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
add a comment |
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
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
magento2.2.6
edited Mar 11 at 14:43
tjjen
asked Mar 7 at 21:51
tjjentjjen
318117
318117
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
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.
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
add a comment |
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!
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
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
add a comment |
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.
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
add a comment |
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.
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.
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
add a comment |
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
add a comment |
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!
add a comment |
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!
add a comment |
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!
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!
answered 9 mins ago
Kirti NariyaKirti Nariya
1,063415
1,063415
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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