$smarty->assign('categories', get_categories_tree_supplier()); // 分类树 $smarty->display('../dianpu1/supplier_catalog.dwt'); exit; } //判断是否有ajax请求 $act = !empty($_GET['act']) ? $_GET['act'] : ''; if ($act == 'cat_rec') { $rec_array = array(1 => 'best', 2 => 'new', 3 => 'hot'); $rec_type = !empty($_REQUEST['rec_type']) ? intval($_REQUEST['rec_type']) : '1'; $cat_id = !empty($_REQUEST['cid']) ? intval($_REQUEST['cid']) : '0'; include_once 'includes/cls_json.php'; $json = new JSON(); $result = array('error' => 0, 'content' => '', 'type' => $rec_type, 'cat_id' => $cat_id); $children = get_children($cat_id); $smarty->assign($rec_array[$rec_type] . '_goods', get_category_recommend_goods($rec_array[$rec_type], $children)); // 推荐商品 $smarty->assign('cat_rec_sign', 1); $result['content'] = $smarty->fetch('library/recommend_' . $rec_array[$rec_type] . '.lbi'); die($json->encode($result)); } /*------------------------------------------------------ */ //-- 判断是否存在缓存,如果存在则调用缓存,反之读取相应内容 /*------------------------------------------------------ */ /* 缓存编号 */ $cache_id = sprintf('%X', crc32($_SESSION['user_rank'] . '-' . $_CFG['lang'] . '-' . $_GET['suppId'])); if (!$smarty->is_cached('mall.dwt', $cache_id)) { //echo "<pre>"; //print_r($_CFG); assign_template(); assign_template_supplier();
$smarty->assign('script_name', 'category'); assign_pager('category', $cat_id, $count, $size, $sort, $order, $page, '', $brand, $price_min, $price_max, $display, $filter_attr_str); // 分页 assign_dynamic('category'); // 动态内容 } /* 获得所有的图片 */ foreach ($goodslist as $key => $goods) { $good_id = $goods['goods_id']; $sql = 'SELECT img_id, img_desc, thumb_url, middle_url, img_url' . ' FROM ' . $ecs->table('goods_gallery') . " WHERE goods_id = '{$good_id}' ORDER BY img_id"; $img_list = $db->getAll($sql); $goodslist[$key]["img_list"] = $img_list; } $smarty->assign('goods_list', $goodslist); $smarty->assign("cate", $cate[$cat_id][cat_id]); $good_hot = get_category_recommend_goods('hot', $children, $brand, $price_min, $price_max, $ext); foreach ($good_hot as $key => $gh) { $good_id = $gh['id']; $sql = 'SELECT img_id, img_desc, thumb_url, middle_url, img_url' . ' FROM ' . $ecs->table('goods_gallery') . " WHERE goods_id = '{$good_id}' ORDER BY img_id"; $img_list = $db->getAll($sql); $good_hot[$key]["img_list"] = $img_list; } $smarty->assign('hot_goods', $good_hot); //echo "<pre>"; //print_r($good_hot); $smarty->display('list.dwt', $cache_id); /*------------------------------------------------------ */ //-- PRIVATE FUNCTION /*------------------------------------------------------ */ /** * 获得分类的信息
$arr = array(); } $brand_list = array_merge($arr, get_brands($cat_id, 'category')); $smarty->assign('data_dir', DATA_DIR); $smarty->assign('brand_list', $brand_list); $smarty->assign('promotion_info', get_promotion_info('', 0)); /* 调查 */ $vote = get_vote(); if (!empty($vote)) { $smarty->assign('vote_id', $vote['id']); $smarty->assign('vote', $vote['content']); } $smarty->assign('best_goods', get_category_recommend_goods('best', $children, $brand, $price_min, $price_max, $ext)); $smarty->assign('promotion_goods', get_category_recommend_goods('promote', $children, $brand, $price_min, $price_max, $ext)); $smarty->assign('hot_goods', get_category_recommend_goods('hot', $children, $brand, $price_min, $price_max, $ext)); $smarty->assign('new_goods', get_category_recommend_goods('new', $children, $brand, $price_min, $price_max, $ext)); $count = get_cagtegory_goods_count($children, $brand, $price_min, $price_max, $ext); $max_page = $count > 0 ? ceil($count / $size) : 1; if ($page > $max_page) { $page = $max_page; } $goodslist = category_get_goods($children, $brand, $price_min, $price_max, $ext, $size, $page, $sort, $order); if ($display == 'grid') { if (count($goodslist) % 2 != 0) { $goodslist[] = array(); } } $smarty->assign('goods_list', $goodslist); $smarty->assign('category', $cat_id); $smarty->assign('script_name', 'category'); $smarty->assign('cat_name_curr', $cat['cat_name']);
if($display == 'grid') { if(count($arr) % 2 != 0) { $arr[] = array(); } } $smarty->assign('goods_list', $arr); $smarty->assign('category', $category); $smarty->assign('keywords', htmlspecialchars(stripslashes($_REQUEST['keywords']))); $smarty->assign('search_keywords', stripslashes(htmlspecialchars_decode($_REQUEST['keywords']))); $smarty->assign('brand', $_REQUEST['brand']); $smarty->assign('min_price', $min_price); $smarty->assign('max_price', $max_price); $smarty->assign('outstock', $_REQUEST['outstock']); $smarty->assign('promotion_goods', get_category_recommend_goods('promote', $dwt_name, $children, $brand, $price_min, $price_max, $ext)); /* 分页 */ $url_format = "search.php?category=$category&keywords=" . urlencode(stripslashes($_REQUEST['keywords'])) . "&brand=" . $_REQUEST['brand']."&action=".$action."&goods_type=" . $_REQUEST['goods_type'] . "&sc_ds=" . $_REQUEST['sc_ds']; if (!empty($intromode)) { $url_format .= "&intro=" . $intromode; } if (isset($_REQUEST['pickout'])) { $url_format .= '&pickout=1'; } $url_format .= "&min_price=" . $_REQUEST['min_price'] ."&max_price=" . $_REQUEST['max_price'] . "&sort=$sort"; $url_format .= "$attr_url&order=$order&page=";