Beispiel #1
0
//产品列表
$cateid = isset($_GET['cateid']) ? (int) $_GET['cateid'] : 0;
$page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
$page_size = isset($_GET['page_size']) ? (int) $_GET['page_size'] : 30;
$cateids = array();
$products = array();
$paged = '';
$lists = array('data' => array(), 'page' => '');
$cateids = ProductsCategory::getChild($cateid);
$is_paged = 0;
if (!$cateids) {
    $is_paged = 1;
    $cate = ProductsCategory::getData($cateid);
    Templates::Assign('cate', $cate);
    $lists = ProductsItem::paging($page, $page_size, "category_id='{$cateid}' AND status=1", "create_time DESC");
    $products = $lists['data'];
    $products = getProducts($products);
    $paged = $lists['page'];
} else {
    foreach ($cateids as $cid) {
        $ccid = $cid['id'];
        if (!($ccids = ProductsCategory::getChild($ccid))) {
            $produs = ProductsItem::getCateProducts($ccid, '*', 'create_time DESC LIMIT 0,10');
        } else {
            $tmp = array();
            foreach ($ccids as $ccid) {
                $tmp[] = $ccid['id'];
            }
            $ccid = implode(',', $tmp);
            $produs = ProductsItem::getList("category_id IN ({$ccid}) AND status=1", '*', 'create_time DESC LIMIT 0,10');