Esempio n. 1
0
    $condition[] = " cid=" . common_pg('cid') . " ";
}
if ($condition) {
    $filter['where'] = implode('and', $condition);
}
//排序
$filter['order'] = " id desc ";
if ($_GET['order'] == 1) {
    $filter['order'] = " outnum desc ";
}
if ($_GET['order'] == 2) {
    $filter['order'] = " outnum asc ";
}
if ($_GET['order'] == 3) {
    $filter['order'] = " clicknum desc ";
}
if ($_GET['order'] == 4) {
    $filter['order'] = " clicknum asc ";
}
$data = $model->paginate($filter, '*', common_pg('p'), 10);
$listArr = $data['data'];
foreach ($listArr as $key => $value) {
    $listArr[$key]['s_name'] = cut_str(deletehtml($value['name']), 15);
    $cate_row = $cateModel->find($value['cid']);
    $listArr[$key]['cname'] = $cate_row['name'];
}
//获取商品类别
$smarty->assign('cateList', $cateModel->findAll(" id>0 "));
$smarty->assign('list', $listArr);
$smarty->assign('page', $model->existPages($data['pager']));
$smarty->setTpl('app/hptshop/templates/goods_index.html')->display();
Esempio n. 2
0
 //获取商品类别
 $cateModel = new Model_ApplistHptShopCate();
 $smarty->assign('cateList', $cateModel->findAll(" id>0 "));
 //获取幻灯片
 $picModel = new Model_ApplistHptShopPic();
 $smarty->assign('picList', $picModel->fetchAll("select * from applist_hpt_shop_pic order by ordernum desc"));
 //数据列表
 $condition = array();
 $url = array();
 $condition[] = " state=2 ";
 //在售
 if ($_GET['keyword']) {
     $condition[] = " name like '%" . common_pg('keyword') . "%' ";
 }
 if ($_GET['cid']) {
     $condition[] = " cid=" . common_pg('cid') . " ";
 }
 if ($condition) {
     $where = implode('and', $condition);
 }
 //排序
 $order = " ordernum desc,id desc ";
 if ($_GET['clicknum']) {
     $order = " clicknum desc ";
 }
 if ($_GET['outnum']) {
     $order = " outnum desc ";
 }
 //分页
 $pageSize = 10;
 //页大小