caching = true; } /* 初始化分页信息 */ $page = isset($_REQUEST['page']) && intval($_REQUEST['page']) > 0 ? intval($_REQUEST['page']) : 1; $size = isset($_CFG['page_size']) && intval($_CFG['page_size']) > 0 ? intval($_CFG['page_size']) : 10; /* 排序、显示方式以及类型 */ $default_display_type = $_CFG['show_order_type'] == '0' ? 'list' : ($_CFG['show_order_type'] == '1' ? 'grid' : 'text'); $default_sort_order_method = $_CFG['sort_order_method'] == '0' ? 'DESC' : 'ASC'; $default_sort_order_type = $_CFG['sort_order_type'] == '0' ? 'goods_id' : ($_CFG['sort_order_type'] == '1' ? 'shop_price' : 'last_update'); $sort = (isset($_REQUEST['sort']) && in_array(trim(strtolower($_REQUEST['sort'])), array('goods_id', 'shop_price', 'last_update', 'sales_volume'))) ? trim($_REQUEST['sort']) : $default_sort_order_type; $order = (isset($_REQUEST['order']) && in_array(trim(strtoupper($_REQUEST['order'])), array('ASC', 'DESC'))) ? trim($_REQUEST['order']) : $default_sort_order_method; $act = isset($_REQUEST['act']) ? $_REQUEST['act'] : ''; $goods_id = isset($_REQUEST['goods_id']) ? intval($_REQUEST['goods_id']) : 0; assign_template('c', 0); $position = assign_ur_here(0, '浏览历史'); $smarty->assign('page_title', $position['title']); // 页面标题 $smarty->assign('ur_here', $position['ur_here']); // 当前位置 $categories_pro = get_category_tree_leve_one(); $smarty->assign('categories_pro', $categories_pro); // 分类树加强版 $smarty->assign('helps', get_shop_help()); // 网店帮助 $smarty->assign('top_goods', get_top10()); // 销售排行 $smarty->assign('show_marketprice', $_CFG['show_marketprice']); //ecmoban模板堂 --zhuo start $area_info = get_area_info($province_id); $area_id = $area_info['region_id']; $where = "regionId = '$province_id'"; $date = array('parent_id'); $warehouse_id = get_table_date('region_warehouse', $where, $date, 2); //ecmoban模板堂 --zhuo end $count = cate_history_count(); $max_page = ($count> 0) ? ceil($count / $size) : 1; if ($page > $max_page) { $page = $max_page; } if($act == 'delHistory'){ include('includes/cls_json.php'); $json = new JSON; $res = array('err_msg' => '', 'result' => '', 'qty' => 1); $goods_history = explode(',',$_COOKIE['ECS']['history']); $list_history = explode(',',$_COOKIE['ECS']['list_history']); $one_history = get_setcookie_goods($goods_history,$goods_id); $two_history = get_setcookie_goods($list_history,$goods_id); setcookie('ECS[history]', implode(',', $one_history), gmtime() + 3600 * 24 * 30); setcookie('ECS[list_history]', implode(',', $two_history), gmtime() + 3600 * 24 * 30); die($json->encode($res)); } $goodslist = cate_history($size,$page, $sort, $order, $warehouse_id, $area_id); //新增分类页商品相册 by mike start 20131128 if(is_array($goodslist)){ foreach($goodslist as $key=>$vo){ $goodslist[$key]['pictures'] = get_goods_gallery($key);// 商品相册 } } //新增分类页商品相册 by mike end $smarty->assign('script_name', 'history_list'); $smarty->assign('category', 0); $smarty->assign('best_goods', get_category_recommend_goods('best', '', 0, 0, 0, '', $warehouse_id, $area_id)); $smarty->assign('goods_list', $goodslist); // 分类游览历史记录 ecmoban模板堂 --zhuo assign_pager('history_list', 0, $count, $size, $sort, $order, $page, '', '', '', '', '', '',''); // 分页 $smarty->display('history_list.dwt', $cache_id); function get_setcookie_goods($list_history,$goods_id){ for($i = 0; $i<=count($list_history); $i++){ if($list_history[$i] == $goods_id){ unset($list_history[$i]); } } return $list_history; } ?>