News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Search results issue + Solution

Started by profyart, April 13, 2017, 12:12:46 PM

Previous topic - Next topic

profyart

joomla 3.6.5
Virtumart 3.2.1

Issue:
Empty page without "no search result"  when search produces no results in default template.

Cause:
File /components/com_virtuemart/views/category/tmpl/default.php
from line 70:
Quote
if (!empty($this->products)) {
.........
.........
.........
<h1><?php echo vmText::_($this->category->category_name); ?></h1>

   <?php
   if (!empty($this->products)) {
      //revert of the fallback in the view.html.php, will be removed vm3.2
      if($this->fallback){
         $p = $this->products;
         $this->products = array();
         $this->products[0] = $p;
         vmdebug('Refallback');
      }

   echo shopFunctionsF::renderVmSubLayout($this->productsLayout,array('products'=>$this->products,'currency'=>$this->currency,'products_per_row'=>$this->perRow,'showRating'=>$this->showRating));

   if(!empty($this->orderByList)) { ?>
      <div class="vm-pagination vm-pagination-bottom"><?php echo $this->vmPagination->getPagesLinks (); ?><span class="vm-page-counter"><?php echo $this->vmPagination->getPagesCounter (); ?></span></div>
   <?php }
} elseif ($this->keyword !== false) {
   echo vmText::_ ('COM_VIRTUEMART_NO_RESULT') . ($this->keyword ? ' : (' . $this->keyword . ')' : ''); <<<< line 158
}

?>
</div>

<?php } ?> <<<< line 163

So "echo vmText::_ ('COM_VIRTUEMART_NO_RESULT')" appears in wrong place.

It should be something like

Quote
if (!empty($this->products)) {
.........
.........
.........
<h1><?php echo vmText::_($this->category->category_name); ?></h1>

   <?php
   if (!empty($this->products)) {
      //revert of the fallback in the view.html.php, will be removed vm3.2
      if($this->fallback){
         $p = $this->products;
         $this->products = array();
         $this->products[0] = $p;
         vmdebug('Refallback');
      }

   echo shopFunctionsF::renderVmSubLayout($this->productsLayout,array('products'=>$this->products,'currency'=>$this->currency,'products_per_row'=>$this->perRow,'showRating'=>$this->showRating));

   if(!empty($this->orderByList)) { ?>
      <div class="vm-pagination vm-pagination-bottom"><?php echo $this->vmPagination->getPagesLinks (); ?><span class="vm-page-counter"><?php echo $this->vmPagination->getPagesCounter (); ?></span></div>
   <?php }
} elseif ($this->keyword !== false) {
   echo vmText::_ ('COM_VIRTUEMART_NO_RESULT') . ($this->keyword ? ' : (' . $this->keyword . ')' : ''); <<<< line 158
}

?>
</div>

<?php } elseif ($this->keyword !== false) {
   echo vmText::_ ('COM_VIRTUEMART_NO_RESULT') . ($this->keyword ? ' : (' . $this->keyword . ')' : '');
}
?>