/* 排序、显示方式以及类型 */ $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')) ? 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; $display = isset($_REQUEST['display']) && in_array(trim(strtolower($_REQUEST['display'])), array('list', 'grid', 'text')) ? trim($_REQUEST['display']) : (isset($_COOKIE['ECS']['display']) ? $_COOKIE['ECS']['display'] : $default_display_type); $display = in_array($display, array('list', 'grid', 'text')) ? $display : 'text'; setcookie('ECS[display]', $display, gmtime() + 86400 * 7); /*------------------------------------------------------ */ //-- PROCESSOR /*------------------------------------------------------ */ /* 页面的缓存ID */ $cache_id = sprintf('%X', crc32($brand_id . '-' . $display . '-' . $sort . '-' . $order . '-' . $page . '-' . $size . '-' . $_SESSION['user_rank'] . '-' . $_CFG['lang'] . '-' . $cate)); if (!$smarty->is_cached('brand.dwt', $cache_id)) { $brand_info = get_brand_info($brand_id); if (empty($brand_info)) { ecs_header("Location: ./\n"); exit; } $smarty->assign('data_dir', DATA_DIR); $smarty->assign('keywords', htmlspecialchars($brand_info['brand_desc'])); $smarty->assign('description', htmlspecialchars($brand_info['brand_desc'])); /* 赋值固定内容 */ assign_template(); $position = assign_ur_here($cate, $brand_info['brand_name']); $smarty->assign('page_title', $position['title']); // 页面标题 $smarty->assign('ur_here', $position['ur_here']); // 当前位置 $smarty->assign('brand_id', $brand_id);
} assign_template('c', $catlist); /* 上一个商品下一个商品 */ $prev_gid = $db->getOne("SELECT goods_id FROM " . $ecs->table('goods') . " WHERE cat_id=" . $goods['cat_id'] . " AND goods_id > " . $goods['goods_id'] . " AND is_on_sale = 1 AND is_alone_sale = 1 AND is_delete = 0 LIMIT 1"); if (!empty($prev_gid)) { $prev_good['url'] = build_uri('goods', array('gid' => $prev_gid), $goods['goods_name']); $smarty->assign('prev_good', $prev_good); //上一个商品 } $next_gid = $db->getOne("SELECT max(goods_id) FROM " . $ecs->table('goods') . " WHERE cat_id=" . $goods['cat_id'] . " AND goods_id < " . $goods['goods_id'] . " AND is_on_sale = 1 AND is_alone_sale = 1 AND is_delete = 0"); if (!empty($next_gid)) { $next_good['url'] = build_uri('goods', array('gid' => $next_gid), $goods['goods_name']); $smarty->assign('next_good', $next_good); //下一个商品 } $brand_info = get_brand_info($goods['brand_id']); $brand_cat_arr = get_brand_cat($brand_info['brand_cat']); $brand_cat_str = ''; if (!empty($brand_info) && !empty($brand_info['brand_cat'])) { $brand_cat_str = ' <code>></code> <a href="' . build_uri('brand_cat', array('bid' => $brand_cat_arr['cat_id']), $val['cat_name']) . '">' . htmlspecialchars($brand_cat_arr['cat_name']) . '</a>'; } if (!empty($brand_info['brand_name'])) { $brand_cat_str .= ' <code>></code> <a href="' . build_uri('brand', array('bid' => $brand_info['brand_id']), $val['brand_name']) . '">' . htmlspecialchars($brand_info['brand_name']) . '</a>'; } $position = assign_ur_here(0, $goods['goods_name'], $brand_cat_str); /* current position */ $smarty->assign('page_title', $position['title']); // 页面标题 $smarty->assign('ur_here', $position['ur_here']); // 当前位置 $properties = get_goods_properties($goods_id);