コード例 #1
0
 /**
  * 商城入口
  */
 public function actionIndex()
 {
     //分类列表
     $Cat = new ModelCat();
     $model['cat_list'] = $Cat->Items();
     //最新上架
     $Product = new ModelProduct();
     $condition = "p.is_default = 'true'";
     $model['new_list'] = $Product->getProducts('g.goods_id,g.name,g.image_default_id,g.price,p.uptime,p.product_id,p.bn', $condition, 'p.uptime DESC', 0, 10);
     $this->render('index', array('model' => $model));
 }
コード例 #2
0
 /**
  * 商品详情
  */
 public function actionIndex()
 {
     $id = $this->get('id');
     $Product = new ModelProduct();
     $model['product'] = $Product->Item($id);
     if (!$model['product']['row']['goods_id']) {
         $this->redirect('/');
     }
     $cid = $model['product']['row']['cat_id'];
     $Cat = new ModelCat();
     $model['cat'] = $Cat->Item("cat_id = {$cid}");
     $model['parent_cat'] = $Cat->Item("cat_id = {$model['cat']['parent_id']}");
     $this->render('index', array('model' => $model, 'row' => $model['product']['row'], 'image' => $model['product']['image']));
 }
コード例 #3
0
 /**
  * 列表
  */
 public function actionIndex()
 {
     $cid = $this->get('cid');
     $page = isset($_GET['page']) ? $this->get('page') : 1;
     $model = array();
     $Product = new ModelProduct();
     $condition = "g.cat_id = {$cid} AND p.is_default = 'true'";
     $model['count'] = $Product->getCount($condition);
     $start = ($page - 1) * $this->pagesize;
     $model['product_list'] = $Product->getProducts('g.goods_id,g.name,g.image_default_id,g.price,p.uptime,p.product_id,p.bn', $condition, 'p.uptime DESC', $start, $this->pagesize);
     $Cat = new ModelCat();
     $model['cat'] = $Cat->Item("cat_id = {$cid}");
     $model['parent_cat'] = $Cat->Item("cat_id = {$model['cat']['parent_id']}");
     $mutli = Page::multi($page, $model['count'], $this->pagesize, '/category.html?cid=' . $cid);
     $this->render('index', array('model' => $model, 'cid' => $cid, 'mutli' => $mutli));
 }
コード例 #4
0
ファイル: Layouts.php プロジェクト: ShuiMuQinHua/yiishop
 /**
  * 全部分类
  * @return mixed
  */
 public static function category()
 {
     $Cat = new ModelCat();
     return $Cat->Items();
 }