_beforeToHtml()) { return $html; } $suggestData = $this->getSuggestData(); if (!($count = count($suggestData))) { return $html; } $count--; $html = ''; return $html; } public function getSuggestData() { if (!$this->_suggestData) { $collection = $this->helper('catalogsearch')->getSuggestCollection(); $query = $this->helper('catalogsearch')->getQueryText(); $counter = 0; $data = array(); foreach ($collection as $item) { $_data = array( 'title' => $item->getQueryText(), 'row_class' => (++$counter)%2?'odd':'even', 'num_of_results' => $item->getNumResults() ); if ($item->getQueryText() == $query) { array_unshift($data, $_data); } else { $data[] = $_data; } } $this->_suggestData = $data; } return $this->_suggestData; } /* * */ }