Beispiel #1
0
 public function goodsByCate($cateID, $n = null, $start = null)
 {
     $cateObj = new CategoryModel();
     $allCates = $cateObj->select();
     $cateList = $cateObj->getCatTree($allCates, $cateID);
     $cateIDList = array($cateID);
     foreach ($cateList as $v) {
         $cateIDList[] = $v['cat_id'];
     }
     $instring = implode(',', $cateIDList);
     $sql = 'select goods_id,goods_name, shop_price, market_price, thumb_img, add_time, goods_img from ' . $this->table . ' where cat_id in (' . $instring . ') order by add_time desc';
     if (is_numeric($n) && is_numeric($start)) {
         $sql .= ' limit ' . $start . ',' . $n;
     }
     $data = $this->db->getAll($sql);
     return $data;
 }
Beispiel #2
0
<?php

define('ACC', true);
require '../system/init.php';
//echo __ROOT__;exit;
$cat = new CategoryModel();
$catlist = $cat->getList();
$cattree = $cat->getCatTree($catlist, 0);
include __ROOT__ . 'view/admin/templates/goodsadd.html';
Beispiel #3
0
<?php

/*
后台文件
Background entry file
*/
if (!defined('ACC')) {
    define('ACC', true);
    require '../system/init.php';
}
//
$cat = new CategoryModel();
$catelist = $cat->getList();
//print_r($catelist);
$catetree = $cat->getCatTree($catelist, 0);
//print_r($catetree);
include __ROOT__ . 'view/admin/templates/catelist.html';
Beispiel #4
0
/*
栏目页。
*/
define('ACC', true);
require '../system/init.php';
$cateObj = new CategoryModel();
$goodsObj = new GoodsModel();
$catID = $_GET['cat_id'];
$cateInfo = $cateObj->find($catID);
if (!isset($cateInfo)) {
    header('Location: index.php');
}
//树状导航
$allCates = $cateObj->select();
$cateList = $cateObj->getCatTree($allCates, 0, 1);
//面包屑导航
$cateNav = $cateObj->getTree($allCates, $catID);
//print_r($cateNav);
//分页显示
$curPage = isset($_GET['page']) ? $_GET['page'] : 1;
$goodsCnt = count($goodsObj->goodsByCate($catID));
$perPage = 4;
$pageObj = new PaginationHelper($goodsCnt, $perPage, $curPage);
$pageMenu = $pageObj->showPageMenu();
//取出栏目下的商品
$goodsList = $goodsObj->goodsByCate($catID, $perPage, ($curPage - 1) * $perPage);
//浏览记录
if (isset($_COOKIE['goods_history'])) {
    $goods_history = _unserialize($_COOKIE['goods_history']);
}