Example #1
0
 function pageindex($inPath)
 {
     $url = $this->getUrlParams($inPath);
     $page = $url['page'] ? (int) $url['page'] : 1;
     $categoryObj = new m_category();
     $this->params['catelist'] = $categoryObj->getOrderCate('    ');
     $condi = '';
     $goodsObj = new m_goods();
     if ($_POST) {
         $key = base_Utils::getStr($_POST['key'], 'html');
         $cat_id = (int) $_POST['cat_id'];
         $this->params['key'] = $key;
         $this->params['cat_id'] = $cat_id;
         $tableName = $goodsObj->tableName();
         if ($key) {
             $condi .= "{$tableName}.goods_name like '%{$key}%' or {$tableName}.goods_sn like '%{$key}%'";
         }
         if ($cat_id) {
             $condi = $condi ? $condi . " and {$tableName}.cat_id = {$cat_id}" : "{$tableName}.cat_id = {$cat_id}";
         }
     }
     $rs = $goodsObj->getGoodsList($condi, $page);
     $this->params['goods'] = $rs->items;
     $this->params['pagebar'] = $this->PageBar($rs->totalSize, base_Constant::PAGE_SIZE, $page, $inPath);
     return $this->render('goods/index.html', $this->params);
 }