...
|
...
|
@@ -53,7 +53,7 @@ class GoodsController extends HomebaseController { |
|
|
$this->display();
|
|
|
}
|
|
|
|
|
|
// 商品列表页
|
|
|
// 商品列表页(pc端)
|
|
|
public function goods_list() {
|
|
|
// 处理筛选内容
|
|
|
$search = I('get.');
|
...
|
...
|
@@ -96,6 +96,7 @@ class GoodsController extends HomebaseController { |
|
|
$price_search = array('0-300','300-2000','2000-5000','5000-10000','10000-20000','20000');
|
|
|
$this->assign('price_search',$price_search);
|
|
|
$this->region();
|
|
|
$this->assign('search_page',U('Portal/Goods/search_page'));
|
|
|
$this->assign('brandList',$this->goods_brand_model->getList());
|
|
|
$this->display();
|
|
|
}
|
...
|
...
|
@@ -156,7 +157,7 @@ class GoodsController extends HomebaseController { |
|
|
$order = array('g.istop'=>'DESC');
|
|
|
}
|
|
|
} else {
|
|
|
$order = array('ctime'=>'DESC');
|
|
|
$order = array('g.ctime'=>'DESC');
|
|
|
}
|
|
|
$count = $this->goods_model->alias('g')
|
|
|
->join('__GOODS_BRAND__ as gb on g.brand_id = gb.id')
|
...
|
...
|
@@ -164,9 +165,9 @@ class GoodsController extends HomebaseController { |
|
|
->where($where)
|
|
|
->count();
|
|
|
|
|
|
$page = $this->page_goods($count, 20);
|
|
|
$page = $this->page_goods($count, 12);
|
|
|
|
|
|
$posts = $this->goods_model->field(array('g.*,gb.brand_name,p.name'))->alias('g')
|
|
|
$posts = $this->goods_model->field(array('g.id,g.sort_id,g.brand_id,g.region_id,g.goods_name,g.short_name,g.goods_price,g.price,g.num,g.thumb,gb.brand_name,p.name'))->alias('g')
|
|
|
->join('__GOODS_BRAND__ as gb on g.brand_id = gb.id')
|
|
|
->join('__PRODUCT__ as p on g.sort_id = p.id')
|
|
|
->where($where)
|
...
|
...
|
@@ -177,6 +178,45 @@ class GoodsController extends HomebaseController { |
|
|
return $posts;
|
|
|
}
|
|
|
|
|
|
// 商品列表页(手机端)
|
|
|
public function goods_list_mobile() {
|
|
|
if(IS_POST) {
|
|
|
// 处理筛选内容
|
|
|
$search['region'] = I('post.region');
|
|
|
$search['price'] = I('post.price');
|
|
|
$search['brand'] = I('post.brand');
|
|
|
$where = $this->goods_search($search);
|
|
|
$_GET['p'] = I('post.page',0,'intval');
|
|
|
|
|
|
if(I('post.id',0,'intval')) {
|
|
|
$ids = $this->product_model->getChildId(I('post.id'));
|
|
|
$where['g.is_del'] = 0;
|
|
|
$where['g.sort_id'] = array('in',$ids);
|
|
|
$goodsList = $this->_lists($where,$search['sort']);
|
|
|
} elseif(I('post.cid',0,'intval')) {
|
|
|
$where['g.is_del'] = 0;
|
|
|
$where['g.sort_id'] = array('in',I('post.cid'));
|
|
|
$goodsList = $this->_lists($where,$search['sort']);
|
|
|
} else {
|
|
|
$this->ajaxReturn(array('status'=>false,'msg'=>'参数错误'));
|
|
|
}
|
|
|
foreach ($goodsList as $k=>$v) {
|
|
|
$goodsList[$k]['thumb'] = sp_get_image_preview_url($v['thumb']);
|
|
|
}
|
|
|
$this->ajaxReturn(array('status'=>true,'msg'=>'成功','data'=>$goodsList));
|
|
|
} else {
|
|
|
$this->assign('id',I('get.id',0,'intval'));
|
|
|
$this->assign('cid',I('get.cid',0,'intval'));
|
|
|
// 筛选功能数组
|
|
|
$price_search = array('0-300','300-2000','2000-5000','5000-10000','10000-20000','20000');
|
|
|
$this->assign('price_search',json_encode($price_search));
|
|
|
$this->region();
|
|
|
$this->assign('brandList',json_encode($this->goods_brand_model->getListName()));
|
|
|
$this->assign('search_page',U('Portal/Goods/search_page'));
|
|
|
$this->display('goods_list');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 商品搜索页面
|
|
|
public function search() {
|
|
|
$keyword = $where['g.goods_name|g.short_name|gb.brand_name|p.name'] = I('get.keyword');
|
...
|
...
|
|