I want to make 1 column layout for search result page when result not available.
How can i achieve this?
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityI want to make 1 column layout for search result page when result not available.
How can i achieve this?
You can create a block rewriting the search results page say
Result.php
and in that
public function getNoResultText()
{
if ($this->catalogSearchData->isMinQueryLength()) {
return __('Minimum Search query length is %1', $this->_getQuery()->getMinQueryLength());
}
return $this->getLayout()->getBlock('zero_res');
}
Now create:-
Custom/Handles/view/frontend/layout/zero_res.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="Custom\Handles\Block\Result" name="zero_res" template="zero_res.phtml"/>
</referenceContainer>
</body>