Example #1
0
 public function getToysBySearchTextAction()
 {
     $search_text = $this->_getParam('search_text');
     $search_text = trim($search_text);
     $old_len = -1;
     while ($old_len != strlen($search_text)) {
         $search_text = str_replace('  ', ' ', $search_text);
         $old_len = strlen($search_text);
     }
     //$search_text = str_replace(' ','%',$search_text);
     $Product = new Product();
     $list_params = $this->get_list_params();
     $options = array('page' => $list_params['pageNumber'], 'perPage' => 20 * $list_params['pl'], 'order' => $list_params['order'], 'orderby' => $list_params['orderby']);
     $Product->get_products_by_search_text($search_text, $options, $rPaginator);
     $rPaginator->setPageRange(10);
     $this->view->toys = $rPaginator->getCurrentItems()->toArray();
     $this->view->paginator = $rPaginator;
     $this->view->h1 = "Результаты поиска";
     $this->view->descr = ' Результаты поиска.';
     $this->view->order = $list_params['order'];
     $this->view->orderby = $list_params['orderby'];
     $this->view->ar_order = $list_params['ar_order'];
     $this->view->pl = $list_params['pl'];
     $this->view->list_type = 'from_category';
     $this->view->show = $list_params['show'];
     //$this->view->toys = $Product->get_products_by_search_text($search_text);
     //$this->_helper->viewRenderer('list-toys');
     if ($this->view->show == 'list') {
         $this->_helper->viewRenderer('list-toys');
     } else {
         $this->_helper->viewRenderer('grid-toys');
     }
     $this->set_layout_vars();
 }