magento - Display specific category products on no results search page -


when search wrong keyword "sdfsdf" in magento site, displays "your search returns no results". here want display category products "similar products" category display "best sellers" on home page. have tried calling block in catalogsearch.xml. catalogsearch.xml doent contain block no results. how can display category products on no results page.

i have idea can display specific category products on .phtml page? if can display specific category of products can call category "result.phtml". help?

my result.phtml

<?php if($this->getresultcount()): ?> <?php echo $this->getmessagesblock()->getgroupedhtml() ?> <div class="page-title category-title">     <?php if ($this->helper('rss/catalog')->gettagfeedurl()): ?>         <a href="<?php echo $this->helper('rss/catalog')->gettagfeedurl() ?>" class="nobr link-rss"><?php echo $this->__('subscribe feed') ?></a>     <?php endif; ?>     <h1><?php echo ($this->getheadertext() || $this->getheadertext() === false) ? $this->getheadertext() : $this->__("search results '%s'", $this->helper('catalogsearch')->getescapedquerytext()) ?></h1> </div>     <?php if ($messages = $this->getnotemessages()):?>     <p class="note-msg">         <?php foreach ($messages $message):?>             <?php echo $message?><br />         <?php endforeach;?>     </p>     <?php endif; ?>     <?php echo $this->getproductlisthtml() ?> <?php else: ?> <div class="page-title category-title">     <h1><?php echo ($this->getheadertext() || $this->getheadertext() === false) ? $this->getheadertext() : $this->__("search results '%s'", $this->helper('catalogsearch')->getescapedquerytext()) ?></h1> </div> <p class="note-msg">     <?php echo ($this->getnoresulttext()) ? $this->getnoresulttext() : $this->__('your search returns no results.') ?>     <?php if ($messages = $this->getnotemessages()):?>         <?php foreach ($messages $message):?>         <br /><?php echo $message?>         <?php endforeach;?>      <?php endif; ?>  </p> <div class="search-noresults"> <h1>meanwhile, may go through our featured categories:</h1>   </div> <?php echo $this->getlayout()->createblock('catalog/product_list')->setcategoryid(18)->settemplate('catalog/product/list.phtml')->tohtml();?>  <?php endif; ?> 

a simple solution within catalogsearch/result.phtml template need setup happens when there no results

<?php if($this->getresultcount()): ?> show results leave default <?php else: ?> no results <?php echo $this->getlayout()->createblock('catalog/product_list')->setcategoryid(4)->settemplate('catalog/product/list.phtml')->tohtml() ?> <?php endif; ?> 

Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -