$smarty->assign('page_count', $shop_list['page_count']); $page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 1; $start_array = range(1, $page); $end_array = range($page, $shop_list['page_count']); if ($page - 5 > 0) { $smarty->assign('start', $page - 3); $start_array = range($page, $page - 2); } if ($shop_list['page_count'] - $page > 5) { $smarty->assign('end', $page + 3); $end_array = range($page, $page + 2); } $page_array = array_merge($start_array, $end_array); sort($page_array); $smarty->assign('page_array', array_unique($page_array)); assign_dynamic('stores'); } /* 显示模板 */ $smarty->display($tpl, $cache_id); /** * 获取所有店铺分类 */ function get_all_category() { $sql = "select * from " . $GLOBALS['ecs']->table('street_category') . " where is_show=1 order by sort_order"; $all = $GLOBALS['db']->getAll($sql); $ret1 = $ret = array(); foreach ($all as $key => $val) { $val['url'] = build_uri('stores', array('cid' => $val['str_id']), $val['str_name']); if ($val['is_groom'] > 0) { $ret[$val['str_id']] = $val;
$products_info .= ' ' . $goods_specifications[$value]['attr_name'] . ':' . $goods_specifications[$value]['attr_value']; } $smarty->assign('products_info', $products_info); unset($goods_specifications, $good_products, $_good_products, $products_info); } } else { show_message($_LANG['now_not_snatch']); } /* 调查 */ $vote = get_vote(); if (!empty($vote)) { $smarty->assign('vote_id', $vote['id']); $smarty->assign('vote', $vote['content']); } assign_template(); assign_dynamic('snatch'); $smarty->assign('page_title', $position['title']); $smarty->assign('ur_here', $position['ur_here']); $smarty->assign('categories', get_categories_tree()); // 分类树 $smarty->assign('helps', get_shop_help()); // 网店帮助 $smarty->assign('snatch_list', get_snatch_list()); //所有有效的夺宝奇兵列表 $smarty->assign('price_list', get_price_list($id)); $smarty->assign('promotion_info', get_promotion_info()); $smarty->assign('feed_url', $_CFG['rewrite'] == 1 ? "feed-typesnatch.xml" : 'feed.php?type=snatch'); // RSS URL $smarty->display('snatch.dwt'); exit; }
$links = index_get_links(); $smarty->assign('img_links', $links['img']); $smarty->assign('txt_links', $links['txt']); $smarty->assign('data_dir', DATA_DIR); // 数据目录 /* 首页推荐分类 */ $cat_recommend_res = $db->getAll("SELECT c.cat_id, c.cat_name, cr.recommend_type FROM " . $ecs->table("cat_recommend") . " AS cr INNER JOIN " . $ecs->table("category") . " AS c ON cr.cat_id=c.cat_id"); if (!empty($cat_recommend_res)) { $cat_rec_array = array(); foreach ($cat_recommend_res as $cat_recommend_data) { $cat_rec[$cat_recommend_data['recommend_type']][] = array('cat_id' => $cat_recommend_data['cat_id'], 'cat_name' => $cat_recommend_data['cat_name']); } $smarty->assign('cat_rec', $cat_rec); } /* 页面中的动态内容 */ assign_dynamic('index'); } /*甜心100修改*/ $userid = $_SESSION['user_id']; if (!empty($userid)) { $affiliate = unserialize($GLOBALS['_CFG']['affiliate']); $level_register_up = (double) $affiliate['config']['level_register_up']; $rank_points = $GLOBALS['db']->getOne("SELECT rank_points FROM " . $GLOBALS['ecs']->table('users') . "where user_id=" . $_SESSION["user_id"]); if ($rank_points > $level_register_up || $rank_points == $level_register_up) { $url = $config['site_url'] . "mobile/index.php?u=" . $userid; //20141204新增分享返积分 $dourl = $config['site_url'] . "mobile/re_url.php?user_id=" . $userid; } else { $url = ""; //20141204新增分享返积分 $dourl = "";
$consignee_list = get_consignee_list($_SESSION['user_id']); $choose['country'] = isset($_POST['country']) ? $_POST['country'] : $consignee_list[0]['country']; $choose['province'] = isset($_POST['province']) ? $_POST['province'] : $consignee_list[0]['province']; $choose['city'] = isset($_POST['city']) ? $_POST['city'] : $consignee_list[0]['city']; $choose['district'] = isset($_POST['district']) ? $_POST['district'] : (isset($consignee_list[0]['district']) ? $consignee_list[0]['district'] : 0); } else { $choose['country'] = isset($_POST['country']) ? $_POST['country'] : $_CFG['shop_country']; $choose['province'] = isset($_POST['province']) ? $_POST['province'] : 2; $choose['city'] = isset($_POST['city']) ? $_POST['city'] : 35; $choose['district'] = isset($_POST['district']) ? $_POST['district'] : 417; } /*------------------------------------------------------ */ //-- PROCESSOR /*------------------------------------------------------ */ assign_template(); assign_dynamic('myship'); $position = assign_ur_here(0, $_LANG['shopping_myship']); $smarty->assign('page_title', $position['title']); // 页面标题 $smarty->assign('ur_here', $position['ur_here']); // 当前位置 $smarty->assign('helps', get_shop_help()); // 网店帮助 $smarty->assign('lang', $_LANG); $smarty->assign('choose', $choose); $province_list[NULL] = get_regions(1, $choose['country']); $city_list[NULL] = get_regions(2, $choose['province']); $district_list[NULL] = get_regions(3, $choose['city']); $smarty->assign('province_list', $province_list); $smarty->assign('city_list', $city_list); $smarty->assign('district_list', $district_list);
} /* current position */ $position = assign_ur_here('exchange', $goods['goods_name']); $smarty->assign('page_title', $position['title']); // 页面标题 $smarty->assign('ur_here', $position['ur_here']); // 当前位置 $properties = get_goods_properties($goods_id); // 获得商品的规格和属性 $smarty->assign('properties', $properties['pro']); // 商品属性 $smarty->assign('specification', $properties['spe']); // 商品规格 $smarty->assign('pictures', get_goods_gallery($goods_id)); // 商品相册 assign_dynamic('exchange_goods'); } } $smarty->display('exchange_goods.dwt', $cache_id); } elseif ($_REQUEST['act'] == 'buy') { /* 查询:判断是否登录 */ if (!isset($back_act) && isset($GLOBALS['_SERVER']['HTTP_REFERER'])) { $back_act = strpos($GLOBALS['_SERVER']['HTTP_REFERER'], 'exchange') ? $GLOBALS['_SERVER']['HTTP_REFERER'] : './index.php'; } /* 查询:判断是否登录 */ if ($_SESSION['user_id'] <= 0) { show_message($_LANG['eg_error_login'], array($_LANG['back_up_page']), array($back_act), 'error'); } /* 查询:取得参数:商品id */ $goods_id = isset($_POST['goods_id']) ? intval($_POST['goods_id']) : 0; if ($goods_id <= 0) {
define('IN_ECS', true); require dirname(__FILE__) . '/includes/init.php'; assign_template(); $position = assign_ur_here(0, $_LANG['tag_cloud']); $smarty->assign('page_title', $position['title']); // 页面标题 $smarty->assign('ur_here', $position['ur_here']); // 当前位置 $smarty->assign('categories', get_categories_tree()); // 分类树 $smarty->assign('categories_pro', get_categories_tree_pro()); // 分类树加强版/* 周改 $smarty->assign('helps', get_shop_help()); // 网店帮助 $smarty->assign('top_goods', get_top10()); // 销售排行 $smarty->assign('promotion_info', get_promotion_info()); /* 调查 */ $vote = get_vote(); if (!empty($vote)) { $smarty->assign('vote_id', $vote['id']); $smarty->assign('vote', $vote['content']); } assign_dynamic('tag_cloud'); $tags = get_tags(); if (!empty($tags)) { include_once ROOT_PATH . 'includes/lib_clips.php'; color_tag($tags); } $smarty->assign('tags', $tags); $smarty->display('tag_cloud.dwt');
$smarty->assign('best_goods', brand_recommend_goods('best', $brand_id, $cate)); $smarty->assign('promotion_goods', brand_recommend_goods('promote', $brand_id, $cate)); $smarty->assign('brand', $brand_info); $smarty->assign('promotion_info', get_promotion_info()); $count = goods_count_by_brand($brand_id, $cate); $goodslist = brand_get_goods($brand_id, $cate, $size, $page, $sort, $order); if ($display == 'grid') { if (count($goodslist) % 2 != 0) { $goodslist[] = array(); } } $smarty->assign('goods_list', $goodslist); $smarty->assign('script_name', 'brand'); assign_pager('brand', $cate, $count, $size, $sort, $order, $page, '', $brand_id, 0, 0, $display); // 分页 assign_dynamic('brand'); // 动态内容 } $smarty->display('brand.dwt', $cache_id); /*------------------------------------------------------ */ //-- PRIVATE FUNCTION /*------------------------------------------------------ */ /** * 获得指定品牌的详细信息. * * @param int $id */ function get_brand_info($id) { $sql = 'SELECT * FROM ' . $GLOBALS['ecs']->table('brand') . " WHERE brand_id = '{$id}'"; return $GLOBALS['db']->getRow($sql);
$smarty->assign('data_dir', DATA_DIR); // 数据目录 /*jdy add 0816 添加首页幻灯插件*/ $smarty->assign("flash", get_flash_xml()); $smarty->assign('flash_count', count(get_flash_xml())); /* 首页推荐分类 */ $cat_recommend_res = $db->getAll("SELECT c.cat_id, c.cat_name, cr.recommend_type FROM " . $ecs->table("cat_recommend") . " AS cr INNER JOIN " . $ecs->table("category") . " AS c ON cr.cat_id=c.cat_id"); if (!empty($cat_recommend_res)) { $cat_rec_array = array(); foreach ($cat_recommend_res as $cat_recommend_data) { $cat_rec[$cat_recommend_data['recommend_type']][] = array('cat_id' => $cat_recommend_data['cat_id'], 'cat_name' => $cat_recommend_data['cat_name']); } $smarty->assign('cat_rec', $cat_rec); } /* 页面中的动态内容 */ assign_dynamic($tpl); } $smarty->display($tpl . '.dwt', $cache_id); /*------------------------------------------------------ */ //-- PRIVATE FUNCTIONS /*------------------------------------------------------ */ /** * 调用发货单查询 * * @access private * @return array */ function index_get_invoice_query() { $sql = 'SELECT o.order_sn, o.invoice_no, s.shipping_code FROM ' . $GLOBALS['ecs']->table('order_info') . ' AS o' . ' LEFT JOIN ' . $GLOBALS['ecs']->table('shipping') . ' AS s ON s.shipping_id = o.shipping_id' . " WHERE invoice_no > '' AND shipping_status = " . SS_SHIPPED . ' ORDER BY shipping_time DESC LIMIT 10'; $all = $GLOBALS['db']->getAll($sql);
$smarty->assign('top_goods', get_top10()); // 销售排行 $smarty->assign('cat_list', cat_list(0, 0, true, 2, false)); $smarty->assign('brand_list', get_brand_list()); $smarty->assign('promotion_info', get_promotion_info()); $smarty->assign('enabled_mes_captcha', intval($_CFG['captcha']) & CAPTCHA_MESSAGE); $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('comment') . " WHERE STATUS =1 AND comment_type =0 "; $record_count = $db->getOne($sql); $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('feedback') . " WHERE `msg_area`='1' AND `msg_status` = '1' "; $record_count += $db->getOne($sql); /* 获取留言的数量 */ $page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 1; $pagesize = get_library_number('message_list', 'message_board'); $pager = get_pager('message.php', array(), $record_count, $page, $pagesize); $msg_lists = get_msg_list($pagesize, $pager['start']); assign_dynamic('message_board'); $smarty->assign('rand', mt_rand()); $smarty->assign('msg_lists', $msg_lists); $smarty->assign('pager', $pager); $smarty->display('message_board.dwt'); } /** * 获取留言的详细信息 * * @param integer $num * @param integer $start * * @return array */ function get_msg_list($num, $start) {
$order = $db->getRow($sql); if (empty($order)) { $msg = $_LANG['order_not_exists']; } elseif ($order['shipping_status'] == SS_RECEIVED) { $msg = $_LANG['order_already_received']; } elseif ($order['shipping_status'] != SS_SHIPPED) { $msg = $_LANG['order_invalid']; } elseif ($order['consignee'] != $consignee) { $msg = $_LANG['order_invalid']; } else { /* 修改订单发货状态为“确认收货” */ $sql = "UPDATE " . $ecs->table('order_info') . " SET shipping_status = '" . SS_RECEIVED . "' WHERE order_id = '{$order_id}'"; $db->query($sql); /* 记录日志 */ order_action($order['order_sn'], $order['order_status'], SS_RECEIVED, $order['pay_status'], '', $_LANG['buyer']); $msg = $_LANG['act_ok']; } /* 显示模板 */ assign_template(); $position = assign_ur_here(); $smarty->assign('page_title', $position['title']); // 页面标题 $smarty->assign('ur_here', $position['ur_here']); // 当前位置 $smarty->assign('categories', get_categories_tree()); // 分类树 $smarty->assign('helps', get_shop_help()); // 网店帮助 assign_dynamic('receive'); $smarty->assign('msg', $msg); $smarty->display('receive.dwt');
} if (isset($_REQUEST['act']) && $_REQUEST['act'] == 'insert_dianpu') { $GLOBALS['db']->query("DELETE FROM " . $GLOBALS['ecs']->table('dianpu') . " WHERE user_id = '" . $_SESSION['user_id'] . "'"); $dianpu_name = isset($_POST['dianpu_name']) ? $_POST['dianpu_name'] : ''; $phone = isset($_POST['phone']) ? $_POST['phone'] : ''; $sql = "INSERT INTO " . $GLOBALS['ecs']->table('dianpu') . "(`dianpu_name`,`phone`,`user_id`) values('{$dianpu_name}','{$phone}','" . $_SESSION['user_id'] . "')"; $num = $GLOBALS['db']->query($sql); if ($num > 0) { show_message('店铺设置成功!', '返回分销中心', 'v_user.php'); } else { ecs_header("Location: v_user_dianpu.php\n"); exit; } } if (!$smarty->is_cached('v_user_dianpu.dwt', $cache_id)) { assign_template(); $position = assign_ur_here(); $smarty->assign('page_title', $position['title']); // 页面标题 $smarty->assign('ur_here', $position['ur_here']); // 当前位置 /* meta information */ $smarty->assign('keywords', htmlspecialchars($_CFG['shop_keywords'])); $smarty->assign('description', htmlspecialchars($_CFG['shop_desc'])); $smarty->assign('user_info', get_user_info_by_user_id($_SESSION['user_id'])); $smarty->assign('dianpu', get_dianpu_by_user_id($_SESSION['user_id'])); $smarty->assign('user_id', $_SESSION['user_id']); /* 页面中的动态内容 */ assign_dynamic('v_user_dianpu'); } $smarty->display('v_user_dianpu.dwt', $cache_id);
* $Author: liubo $ * $Id: activity.php 16056 2009-05-21 05:44:14Z liubo $ */ define('IN_ECS', true); require dirname(__FILE__) . '/includes/init.php'; require_once ROOT_PATH . 'includes/lib_order.php'; include_once ROOT_PATH . 'includes/lib_transaction.php'; /* 载入语言文件 */ require_once ROOT_PATH . 'languages/' . $_CFG['lang'] . '/shopping_flow.php'; require_once ROOT_PATH . 'languages/' . $_CFG['lang'] . '/user.php'; require_once ROOT_PATH . 'languages/' . $_CFG['lang'] . '/admin/package.php'; /*------------------------------------------------------ */ //-- PROCESSOR /*------------------------------------------------------ */ assign_template(); assign_dynamic('package'); $position = assign_ur_here(0, $_LANG['shopping_package']); $smarty->assign('page_title', $position['title']); // 页面标题 $smarty->assign('ur_here', $position['ur_here']); // 当前位置 /* 读出所有礼包信息 */ $now = gmtime(); $sql = "SELECT * FROM " . $ecs->table('goods_activity') . " WHERE `start_time` <= '{$now}' AND `end_time` >= '{$now}' AND `act_type` = '4' ORDER BY `end_time`"; $res = $db->query($sql); $list = array(); while ($row = $db->fetchRow($res)) { $row['start_time'] = local_date('Y-m-d H:i', $row['start_time']); $row['end_time'] = local_date('Y-m-d H:i', $row['end_time']); $ext_arr = unserialize($row['ext_info']); unset($row['ext_info']);
$smarty->assign('pager', $pager); assign_template(); assign_dynamic('search'); $position = assign_ur_here(0, $ur_here); $smarty->assign('page_title', $position['title']); // 页面标题 $smarty->assign('ur_here', $position['ur_here']); // 当前位置 $smarty->assign('intromode', $intromode); $smarty->assign('categories', get_categories_tree()); // 分类树 $smarty->assign('helps', get_shop_help()); // 网店帮助 $smarty->assign('top_goods', get_top10()); // 销售排行 assign_dynamic('search_result'); $smarty->display('search.dwt'); } /*------------------------------------------------------ */ //-- PRIVATE FUNCTION /*------------------------------------------------------ */ /** * * * @access public * @param * * @return void */ function is_not_null($value) {
// 当前位置 $smarty->assign('comment_type', 1); assign_template_supplier(); /* 上一篇下一篇文章 */ $next_article = $db->getRow("SELECT article_id, title FROM " . $ecs->table('supplier_article') . " WHERE article_id > {$article_id} AND cat_id={$article['cat_id']} AND is_open=1 AND supplier_id=" . $_GET['suppId'] . " LIMIT 1"); if (!empty($next_article)) { $next_article['url'] = build_uri('supplier', array('go' => 'article', 'suppid' => $_GET['suppId'], 'aid' => $next_article['supplier_article']), $next_article['title']); $smarty->assign('next_article', $next_article); } $prev_aid = $db->getOne("SELECT max(article_id) FROM " . $ecs->table('supplier_article') . " WHERE article_id < {$article_id} AND cat_id={$article['cat_id']} AND is_open=1 AND supplier_id=" . $_GET['suppId']); if (!empty($prev_aid)) { $prev_article = $db->getRow("SELECT article_id, title FROM " . $ecs->table('supplier_article') . " WHERE article_id = {$prev_aid}"); $prev_article['url'] = build_uri('supplier', array('go' => 'article', 'suppid' => $_GET['suppId'], 'aid' => $prev_article['article_id']), $prev_article['title']); $smarty->assign('prev_article', $prev_article); } assign_dynamic('article_pro'); } //if(isset($article) && $article['cat_id'] > 2) //{ // $smarty->display('article.dwt', $cache_id); //} //else //{ $smarty->display('article_pro.dwt', $cache_id); //} /*------------------------------------------------------ */ //-- PRIVATE FUNCTION /*------------------------------------------------------ */ /** * 获得指定的文章的详细信息 *
$tmp = $ids; $key = array_search($goods_id, $tmp); if ($key !== null && $key !== false) { unset($tmp[$key]); } $arr[$goods_id]['ids'] = !empty($tmp) ? "goods[]=" . implode('&goods[]=', $tmp) : ''; } $sql = "SELECT attr_id,attr_name FROM " . $ecs->table('attribute') . " WHERE cat_id='{$type_id}' ORDER BY attr_id"; $attribute = array(); $query = $db->query($sql); while ($rt = $db->fetch_array($query)) { $attribute[$rt['attr_id']] = $rt['attr_name']; } $smarty->assign('attribute', $attribute); $smarty->assign('goods_list', $arr); } else { show_message($_LANG['compare_no_goods']); exit; } assign_template(); $position = assign_ur_here(0, $_LANG['goods_compare']); $smarty->assign('page_title', $position['title']); // 页面标题 $smarty->assign('ur_here', $position['ur_here']); // 当前位置 $smarty->assign('categories', get_categories_tree()); // 分类树 $smarty->assign('helps', get_shop_help()); // 网店帮助 assign_dynamic('compare'); $smarty->display('compare.dwt');
//模板赋值 $smarty->assign('cfg', $_CFG); assign_template(); $position = assign_ur_here(0, $goods['goods_name']); $smarty->assign('page_title', $position['title']); // 页面标题 $smarty->assign('ur_here', $position['ur_here']); // 当前位置 $smarty->assign('categories', get_categories_tree()); // 分类树 $smarty->assign('helps', get_shop_help()); // 网店帮助 $smarty->assign('top_goods', get_top10()); // 销售排行 $smarty->assign('promotion_info', get_promotion_info()); assign_dynamic('auction'); } //更新商品点击次数 $sql = 'UPDATE ' . $ecs->table('goods') . ' SET click_count = click_count + 1 ' . "WHERE goods_id = '" . $auction['goods_id'] . "'"; $db->query($sql); $smarty->assign('now_time', gmtime()); // 当前系统时间 $smarty->display('auction.dwt', $cache_id); } elseif ($_REQUEST['act'] == 'bid') { include_once ROOT_PATH . 'includes/lib_order.php'; /* 取得参数:拍卖活动id */ $id = isset($_POST['id']) ? intval($_POST['id']) : 0; if ($id <= 0) { ecs_header("Location: ./\n"); exit; }
$smarty->assign('your_discount', sprintf($_LANG['your_discount'], $favour_name, price_format($discount['discount']))); /* 增加是否在购物车里显示商品图 */ $smarty->assign('show_goods_thumb', $GLOBALS['_CFG']['show_goods_in_cart']); /* 增加是否在购物车里显示商品属性 */ $smarty->assign('show_goods_attribute', $GLOBALS['_CFG']['show_attr_in_cart']); /* 购物车中商品配件列表 */ //取得购物车中基本件ID $sql = "SELECT goods_id " . "FROM " . $GLOBALS['ecs']->table('cart') . " WHERE session_id = '" . SESS_ID . "' " . "AND rec_type = '" . CART_GENERAL_GOODS . "' " . "AND is_gift = 0 " . "AND extension_code <> 'package_buy' " . "AND parent_id = 0 "; $parent_list = $GLOBALS['db']->getCol($sql); $fittings_list = get_goods_fittings($parent_list); $smarty->assign('fittings_list', $fittings_list); } $smarty->assign('currency_format', $_CFG['currency_format']); $smarty->assign('integral_scale', $_CFG['integral_scale']); $smarty->assign('step', $_REQUEST['step']); assign_dynamic('shopping_flow'); $smarty->display('flow.dwt'); /*------------------------------------------------------ */ //-- PRIVATE FUNCTION /*------------------------------------------------------ */ /** * 获得用户的可用积分 * * @access private * @return integral */ function flow_available_points() { $sql = "SELECT SUM(g.integral * c.goods_number) " . "FROM " . $GLOBALS['ecs']->table('cart') . " AS c, " . $GLOBALS['ecs']->table('goods') . " AS g " . "WHERE c.session_id = '" . SESS_ID . "' AND c.goods_id = g.goods_id AND c.is_gift = 0 AND g.integral > 0 " . "AND c.rec_type = '" . CART_GENERAL_GOODS . "'"; $val = intval($GLOBALS['db']->getOne($sql)); return integral_of_value($val);
$smarty->assign('cart_goods', isset($_SESSION['wholesale_goods']) ? $_SESSION['wholesale_goods'] : array()); } /* 模板赋值 */ assign_template(); $position = assign_ur_here(); $smarty->assign('page_title', $position['title']); // 页面标题 $smarty->assign('ur_here', $position['ur_here']); // 当前位置 $smarty->assign('categories', get_categories_tree()); // 分类树 $smarty->assign('helps', get_shop_help()); // 网店帮助 $smarty->assign('top_goods', get_top10()); // 销售排行 assign_dynamic('wholesale'); /* 显示模板 */ $smarty->display('wholesale_list.dwt'); } elseif ($_REQUEST['act'] == 'price_list') { $data = $_LANG['goods_name'] . "\t" . $_LANG['goods_attr'] . "\t" . $_LANG['number'] . "\t" . $_LANG['ws_price'] . "\t\n"; $sql = "SELECT * FROM " . $ecs->table('wholesale') . "WHERE enabled = 1 AND CONCAT(',', rank_ids, ',') LIKE '" . '%,' . $_SESSION['user_rank'] . ',%' . "'"; $res = $db->query($sql); while ($row = $db->fetchRow($res)) { $price_list = unserialize($row['prices']); foreach ($price_list as $attr_price) { if ($attr_price['attr']) { $sql = "SELECT attr_value FROM " . $ecs->table('goods_attr') . " WHERE goods_attr_id " . db_create_in($attr_price['attr']); $goods_attr = join(',', $db->getCol($sql)); } else { $goods_attr = ''; }
*/ define('IN_ECS', true); require dirname(__FILE__) . '/includes/init.php'; if ((DEBUG_MODE & 2) != 2) { $smarty->caching = true; } if (!$smarty->is_cached('catalog.dwt')) { /* 取出所有分类 */ $cat_list = cat_list(0, 0, false); foreach ($cat_list as $key => $val) { if ($val['is_show'] == 0) { unset($cat_list[$key]); } } assign_template(); assign_dynamic('catalog'); $position = assign_ur_here(0, $_LANG['catalog']); $smarty->assign('page_title', $position['title']); // 页面标题 $smarty->assign('ur_here', $position['ur_here']); // 当前位置 $smarty->assign('helps', get_shop_help()); // 网店帮助 $smarty->assign('cat_list', $cat_list); // 分类列表 $smarty->assign('categories', get_categories_tree()); // 分类树 $smarty->assign('brand_list', get_brands()); // 所以品牌赋值 $smarty->assign('promotion_info', get_promotion_info()); }
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('categories2', get_children_tree($cat_id)); $smarty->assign('category', $cat_id); $smarty->assign('script_name', $dwt_name); assign_pager('category', $cat_id, $count, $size, $sort, $order, $page, '', $brand, $price_min, $price_max, $display, $filter_attr_str); // 分页 assign_dynamic($dwt_name); // 动态内容 } $smarty->display($dwt_name . '.dwt', $cache_id); /*------------------------------------------------------ */ //-- PRIVATE FUNCTION /*------------------------------------------------------ */ /** * 获得分类的信息 * * @param integer $cat_id * * @return void */ function get_cat_info($cat_id) {
if (!empty($next_article)) { $next_article['url'] = build_uri('article', array('aid'=>$next_article['article_id']), $next_article['title']); $smarty->assign('next_article', $next_article); } $prev_aid = $db->getOne("SELECT max(article_id) FROM " . $ecs->table('article') . " WHERE article_id < $article_id AND cat_id=$article[cat_id] AND is_open=1"); if (!empty($prev_aid)) { $prev_article = $db->getRow("SELECT article_id, title FROM " .$ecs->table('article'). " WHERE article_id = $prev_aid"); $prev_article['url'] = build_uri('article', array('aid'=>$prev_article['article_id']), $prev_article['title']); $smarty->assign('prev_article', $prev_article); }*/ assign_dynamic('article'); } if (isset($article) && $article['cat_id'] > 2) { if ($article['cat_id'] == 32) { $smarty->display('zt.dwt', $cache_id); } else { if ($_REQUEST['type'] == 'sjs') { $smarty->display('article_sjs.dwt', $cache_id); } else { $smarty->display('article_jiaru.dwt', $cache_id); } } } else { if ($_REQUEST['type'] == 'fu') { $smarty->display('article_jiaru0.dwt', $cache_id); } else {
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']); $smarty->assign('condition', $condition); $smarty->assign('brand_have_logo', $brand_have_logo); $smarty->assign('filter_attr_count', count($all_attr_list)); $filter = isset($_REQUEST['filter']) ? intval($_REQUEST['filter']) : 0; assign_pager('category', $cat_id, $count, $size, $sort, $order, $page, '', $brand, $price_min, $price_max, $display, $filter_attr_str, '', '', $filter); // 分页 assign_dynamic('category'); // 动态内容 } function get_categories($cat_id = 0) { if ($cat_id > 0) { $parent_id = $cat_id; } else { $parent_id = 0; } /* 判断当前分类中全是是否是底级分类, 如果是取出底级分类上级分类, 如果不是取当前分类及其下的子分类 */ $sql = 'SELECT count(*) FROM ' . $GLOBALS['ecs']->table('category') . " WHERE parent_id = '{$cat_id}' AND is_show = 1 ";
// 特价商品 $smarty->assign('top_goods', get_top10()); // 销售排行 //yyy添加start $count1 = $GLOBALS['db']->getOne("SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('comment') . " where comment_type=0 and id_value ='{$goods_id}' and status=1"); $smarty->assign('review_count', $count1); //yyy添加end名 //获取tag $tag_array = get_tags($goods_id); $smarty->assign('tags', $tag_array); // 商品的标记 //获取关联礼包 $package_goods_list = get_package_goods_list($goods['goods_id']); $smarty->assign('package_goods_list', $package_goods_list); // 获取关联礼包 assign_dynamic('goods'); $volume_price_list = get_volume_price_list($goods['goods_id'], '1'); $smarty->assign('volume_price_list', $volume_price_list); // 商品优惠价格区间 //评价晒单 增加 by www.68ecshop.com $rank_num['rank_a'] = $db->getOne("SELECT COUNT(*) AS num FROM " . $ecs->table('comment') . " WHERE id_value = '{$goods_id}' AND status = 1 AND comment_rank in (5,4)"); $rank_num['rank_b'] = $db->getOne("SELECT COUNT(*) AS num FROM " . $ecs->table('comment') . " WHERE id_value = '{$goods_id}' AND status = 1 AND comment_rank in (3,2)"); $rank_num['rank_c'] = $db->getOne("SELECT COUNT(*) AS num FROM " . $ecs->table('comment') . " WHERE id_value = '{$goods_id}' AND status = 1 AND comment_rank = 1"); $rank_num['rank_total'] = $rank_num['rank_a'] + $rank_num['rank_b'] + $rank_num['rank_c']; $rank_num['rank_pa'] = $rank_num['rank_a'] > 0 ? round($rank_num['rank_a'] / $rank_num['rank_total'] * 100, 1) : 0; $rank_num['rank_pb'] = $rank_num['rank_b'] > 0 ? round($rank_num['rank_b'] / $rank_num['rank_total'] * 100, 1) : 0; $rank_num['rank_pc'] = $rank_num['rank_c'] > 0 ? round($rank_num['rank_c'] / $rank_num['rank_total'] * 100, 1) : 0; $rank_num['shaidan_num'] = $db->getOne("SELECT COUNT(*) AS num FROM " . $ecs->table('shaidan') . " WHERE goods_id = '{$goods_id}' AND status = 1"); $smarty->assign('rank_num', $rank_num); $res = $GLOBALS['db']->getAll("SELECT * FROM " . $GLOBALS['ecs']->table('goods_tag') . " WHERE goods_id = '{$goods_id}' AND state = 1"); foreach ($res as $v) {
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="; $pager['search'] = array('keywords' => stripslashes(urlencode($_REQUEST['keywords'])), 'category' => $category, 'brand' => $_REQUEST['brand'], 'sort' => $sort, 'order' => $order, 'min_price' => $_REQUEST['min_price'], 'max_price' => $_REQUEST['max_price'], 'action' => $action, 'intro' => empty($intromode) ? '' : trim($intromode), 'goods_type' => $_REQUEST['goods_type'], 'sc_ds' => $_REQUEST['sc_ds'], 'outstock' => $_REQUEST['outstock']); $pager['search'] = array_merge($pager['search'], $attr_arg); $pager = get_pager('search.php', $pager['search'], $count, $page, $size); $pager['display'] = $display; $smarty->assign('url_format', $url_format); $smarty->assign('pager', $pager); assign_template(); assign_dynamic('search'); $position = assign_ur_here(0, $ur_here . ($_REQUEST['keywords'] ? '_' . $_REQUEST['keywords'] : '')); $smarty->assign('page_title', $position['title']); // 页面标题 $smarty->assign('ur_here', $position['ur_here']); // 当前位置 $smarty->assign('intromode', $intromode); $smarty->assign('categories', get_categories_tree()); // 分类树 $smarty->assign('helps', get_shop_help()); // 网店帮助 $smarty->assign('top_goods', get_top10()); // 销售排行 $smarty->assign('promotion_info', get_promotion_info()); $smarty->display('search.dwt'); }
//分类列表 $smarty->assign('categories', get_categories_tree()); // 分类树 $smarty->assign('helps', get_shop_help()); // 网店帮助 $smarty->assign('top_goods', get_top10()); // 销售排行 $smarty->assign('data_dir', DATA_DIR); // 数据目录 /* 调查 */ $vote = get_vote(); if (!empty($vote)) { $smarty->assign('vote_id', $vote['id']); $smarty->assign('vote', $vote['content']); } assign_dynamic('pick_out'); $smarty->assign('url', $url); $smarty->assign('pickout_goods', $goods); $smarty->assign('count', $goods_count); $smarty->assign('picks', $picks); $smarty->assign('condition', $condition); $smarty->display('pick_out.dwt'); /** * 生成搜索的链接地址 * * @access public * @param int attr_id 要排除的attr_id * * @return string */ function search_url(&$attr_picks, $attr_id = 0)
$smarty->assign('gb_list', $gb_list); //模板赋值 $smarty->assign('cfg', $_CFG); assign_template(); $smarty->assign('script_name', 'group'); $position = assign_ur_here(0, $goods['goods_name']); $smarty->assign('page_title', $position['title']); // 页面标题 $smarty->assign('ur_here', $position['ur_here']); // 当前位置 $smarty->assign('hot_goods', get_recommend_goods('hot')); // 最热商品 $smarty->assign('categories', get_categories_tree()); // 分类树 $smarty->assign('helps', get_shop_help()); // 网店帮助 $smarty->assign('top_goods', get_top10()); // 销售排行 $smarty->assign('promotion_info', get_promotion_info()); assign_dynamic('group_buy_goods'); } //更新商品点击次数 $sql = 'UPDATE ' . $ecs->table('goods') . ' SET click_count = click_count + 1 '. "WHERE goods_id = '" . $group_buy['goods_id'] . "'"; $db->query($sql); $smarty->assign('now_time', gmtime()); // 当前系统时间 $smarty->display('group_buy_goods.dwt', $cache_id); } /*------------------------------------------------------ */ //-- 团购商品 --> 购买 /*------------------------------------------------------ */
$pages = $count > 0 ? ceil($count / $size) : 1; if ($page > $pages) { $page = $pages; } $pager['search']['id'] = $cat_id; $keywords = ''; $goon_keywords = ''; //继续传递的搜索关键词 /* 获得文章列表 */ if (isset($_REQUEST['keywords'])) { $keywords = addslashes(htmlspecialchars(urldecode(trim($_REQUEST['keywords'])))); $pager['search']['keywords'] = $keywords; $search_url = substr(strrchr($_POST['cur_url'], '/'), 1); $smarty->assign('search_value', stripslashes(stripslashes($keywords))); $smarty->assign('search_url', $search_url); $count = get_article_count($cat_id, $keywords); $pages = $count > 0 ? ceil($count / $size) : 1; if ($page > $pages) { $page = $pages; } $goon_keywords = urlencode($_REQUEST['keywords']); } $smarty->assign('artciles_list', get_cat_articles($cat_id, $page, $size, $keywords)); $smarty->assign('cat_id', $cat_id); /* 分页 */ assign_pager('article_cat', $cat_id, $count, $size, '', '', $page, $goon_keywords); assign_dynamic('article_cat'); } $smarty->assign('feed_url', $_CFG['rewrite'] == 1 ? "feed-typearticle_cat" . $cat_id . ".xml" : 'feed.php?type=article_cat' . $cat_id); // RSS URL $smarty->display('article_cat.dwt', $cache_id);
* ============================================================================ * $Author: liubo $ * $Id: activity.php 17217 2011-01-19 06:29:08Z liubo $ */ define('IN_ECS', true); require dirname(__FILE__) . '/includes/init.php'; require_once ROOT_PATH . 'includes/lib_order.php'; include_once ROOT_PATH . 'includes/lib_transaction.php'; /* 载入语言文件 */ require_once ROOT_PATH . 'languages/' . $_CFG['lang'] . '/shopping_flow.php'; require_once ROOT_PATH . 'languages/' . $_CFG['lang'] . '/user.php'; /*------------------------------------------------------ */ //-- PROCESSOR /*------------------------------------------------------ */ assign_template(); assign_dynamic('activity'); $position = assign_ur_here(0, $_LANG['shopping_activity']); $smarty->assign('page_title', $position['title']); // 页面标题 $smarty->assign('ur_here', $position['ur_here']); // 当前位置 // 数据准备 /* 取得用户等级 */ $user_rank_list = array(); $user_rank_list[0] = $_LANG['not_user']; $sql = "SELECT rank_id, rank_name FROM " . $ecs->table('user_rank'); $res = $db->query($sql); while ($row = $db->fetchRow($res)) { $user_rank_list[$row['rank_id']] = $row['rank_name']; } // 开始工作
//$smarty->assign('new_articles', index_get_new_articles()); // 最新文章 /* links */ $smarty->assign('data_dir', DATA_DIR); // 数据目录 $smarty->assign('suppinfo', $suppinfo); /* 首页推荐分类 */ $cat_recommend_res = $db->getAll("SELECT c.cat_id, c.cat_name, cr.recommend_type FROM " . $ecs->table("cat_recommend") . " AS cr INNER JOIN " . $ecs->table("category") . " AS c ON cr.cat_id=c.cat_id"); if (!empty($cat_recommend_res)) { $cat_rec_array = array(); foreach ($cat_recommend_res as $cat_recommend_data) { $cat_rec[$cat_recommend_data['recommend_type']][] = array('cat_id' => $cat_recommend_data['cat_id'], 'cat_name' => $cat_recommend_data['cat_name']); } $smarty->assign('cat_rec', $cat_rec); } /* 页面中的动态内容 */ assign_dynamic('mall'); } $smarty->display('mall.dwt', $cache_id); /*------------------------------------------------------ */ //-- PRIVATE FUNCTIONS /*------------------------------------------------------ */ /** * 获得最新的文章列表。 * * @access private * @return array */ function index_get_new_articles() { $sql = 'SELECT a.article_id, a.title, ac.cat_name, a.add_time, a.file_url, a.open_type, ac.cat_id, ac.cat_name ' . ' FROM ' . $GLOBALS['ecs']->table('supplier_article') . ' AS a, ' . $GLOBALS['ecs']->table('supplier_article_cat') . ' AS ac' . ' WHERE a.is_open = 1 AND a.cat_id = ac.cat_id AND ac.cat_id =' . $_GET['suppId'] . ' ORDER BY a.article_type DESC, a.add_time DESC LIMIT ' . $GLOBALS['_CFG']['article_number']; $res = $GLOBALS['db']->getAll($sql);
/* 相关商品 */ $sql = "SELECT a.goods_id, g.goods_name " . "FROM " . $ecs->table('goods_article') . " AS a, " . $ecs->table('goods') . " AS g " . "WHERE a.goods_id = g.goods_id " . "AND a.article_id = '{$_REQUEST['id']}' "; $smarty->assign('goods_list', $db->getAll($sql)); /* 上一篇下一篇文章 */ $next_article = $db->getRow("SELECT article_id, title FROM " . $ecs->table('article') . " WHERE article_id > {$article_id} AND cat_id={$article['cat_id']} AND is_open=1 LIMIT 1"); if (!empty($next_article)) { $next_article['url'] = build_uri('article', array('aid' => $next_article['article_id']), $next_article['title']); $smarty->assign('next_article', $next_article); } $prev_aid = $db->getOne("SELECT max(article_id) FROM " . $ecs->table('article') . " WHERE article_id < {$article_id} AND cat_id={$article['cat_id']} AND is_open=1"); if (!empty($prev_aid)) { $prev_article = $db->getRow("SELECT article_id, title FROM " . $ecs->table('article') . " WHERE article_id = {$prev_aid}"); $prev_article['url'] = build_uri('article', array('aid' => $prev_article['article_id']), $prev_article['title']); $smarty->assign('prev_article', $prev_article); } assign_dynamic('help'); } $smarty->display('help.dwt', $cache_id); /*------------------------------------------------------ */ //-- PRIVATE FUNCTION /*------------------------------------------------------ */ /** * 获得指定的文章的详细信息 * * @access private * @param integer $article_id * @return array */ function get_article_info($article_id) { /* 获得文章的信息 */