In empty search result page, I need to display the product list of a particular category. So, I have added the code
<?php echo $this->getLayout()->createBlock('catalog/product_list')->setCategoryId(5)->setTemplate('catalog/product/list.phtml')->toHtml()?>
in catalogsearch/result.phtml. But this is not worked.
While check the flow, I have found that $this->getLayer() calls the catalogsearch in app/code/core/Mage/Catalog/Block/Product/List.php. Can I change the layer as Catalog, if the search is empty. If it is possible to change the layer, then how to do that?
Best Answer
Write down below code in your
result.phtml
If not write down following code...
$category_id=2;
// your category id here..