Exemplo n.º 1
0
 public function getProductsByCatAction()
 {
     $view = new Zend_View();
     $cat = $this->_getParam('cat');
     $section = $this->_getParam('section');
     //определение perpage и sort
     $params = glob_getParams();
     $perpage = $params['pp'];
     $sort = $params['porder'];
     //---------------
     $db = new Application_Model_DbTable_Categories();
     $db_p = new Application_Model_DbTable_Products();
     $cc = $db->getCategoryById($cat);
     $page = $this->_getParam('page');
     if (!$page) {
         $page = 1;
     }
     $childs = $cc[0]['children'];
     $this->view->caption = $cc[0]['name'];
     $this->view->category = $cat;
     $this->view->section = $section;
     $this->view->perpage = $perpage;
     $this->view->sort = $sort;
     $params = array('childs' => $childs, 'perpage' => $perpage, 'curpage' => $page, 'order' => $sort);
     $pager = "";
     $db_p->getProductsByChilds($params, $pager);
     $this->view->pager = $pager;
     $this->view->curpage = $page;
     $this->view->products = $pager->getCurrentItems()->toArray();
     $this->view->adsense = glob_getGoogleAd(1);
 }