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