Beispiel #1
0
 /**
  * 取出指定栏目的商品
  * @param $cat_id
  * @return array $sons
  */
 public function getGoodsByCat($cat_id)
 {
     $category = new CatModel();
     $cats = $category->getList();
     $sons = $category->getListTree($cats, $cat_id);
     $sub = array($cat_id);
     if (!empty($sons)) {
         foreach ($sons as $v) {
             $sub[] = $v['cat_id'];
         }
     }
     $in = implode(',', $sub);
     $sql = 'select goods_id,goods_name,shop_price,market_price,thumb_img from ' . $this->table . ' where cat_id in (' . $in . ') order by add_time';
     return $this->db->getAll($sql);
 }
Beispiel #2
0
<?php

define('ACC', true);
require '../include/init.php';
/***
 * file catelist.php
 * 目录列表显示页面控制器
 * @author zhangyang
 */
$cat = new CatModel();
$catelist = $cat->getList();
$catelist = $cat->getListTree($catelist, 0);
include ROOT . 'view/admin/templates/catelist.html';
Beispiel #3
0
<?php

define('ACC', true);
/**
 * Created by PhpStorm.
 * User: 洋
 * Date: 2015/8/19 0019
 * Time: 16:25
 */
require './include/init.php';
$cat = new CatModel();
$catList = $cat->getList();
$catList = $cat->getListTree($catList, 0);
$goods = new GoodsModel();
if (isset($_GET['cat_id'])) {
    $goodsList = $goods->getGoodsByCat($_GET['cat_id']);
    $catFamily = $cat->getFamilyTree($_GET['cat_id']);
    $catFamily = array_reverse($catFamily);
} else {
    $goodsList = $goods->getGoodsByCat(0);
}
include ROOT . 'view/front/lanmu.html';