What I need to do is, if a person search for a product then if products found the layout need to be page/2columns-left.phtml
with layered navigation
but if there were no results then its layout should be page/1column.phtml
and it will display new products
, popular products
.
One of the solution I came around is to override the CatalogSearch/ResultController
's indexAction()
where I can get whether $query->getNumResults()
is 0
or not. On that basis how could I load layout differently?
If there's another better approach to this, that would be helpful too.