$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('flash_theme', $_CFG['flash_theme']); // Flash轮播图片模板 $smarty->assign('feed_url', $_CFG['rewrite'] == 1 ? 'feed.xml' : 'feed.php'); // RSS URL $smarty->assign('categories', get_categories_tree()); // 分类树 $smarty->assign('helps', get_shop_help()); // 网店帮助 $smarty->assign('top_goods', get_top10()); // 销售排行 $smarty->assign('best_goods', get_recommend_goods('best')); // 推荐商品 $smarty->assign('new_goods', get_recommend_goods('new')); // 最新商品 $smarty->assign('hot_goods', get_recommend_goods('hot')); // 热点文章 $smarty->assign('promotion_goods', get_promote_goods()); // 特价商品 $smarty->assign('brand_list', get_brands()); $smarty->assign('promotion_info', get_promotion_info()); // 增加一个动态显示所有促销信息的标签栏 $smarty->assign('invoice_list', index_get_invoice_query()); // 发货查询 $smarty->assign('new_articles', index_get_new_articles());
$smarty->assign('description', htmlspecialchars($_CFG['shop_desc'])); $smarty->assign('flash_theme', $_CFG['flash_theme']); // Flash轮播图片模板 $smarty->assign('feed_url', $_CFG['rewrite'] == 1 ? 'feed.xml' : 'feed.php'); // RSS URL $smarty->assign('categories', get_categories_tree()); // 分类树 $smarty->assign('helps', get_shop_help()); // 网店帮助 $smarty->assign('top_goods', get_top10()); // 销售排行 ///llx添加start $smarty->assign('top_goods1', get_top10(16)); $smarty->assign('top_goods2', get_top10(81)); $smarty->assign('top_goods3', get_top10(17)); $smarty->assign('top_goods4', get_top10(93)); ///llx添加end $best_goods = get_recommend_goods('best'); $smarty->assign('best_goods', $best_goods); // 推荐商品 $smarty->assign('new_goods', get_recommend_goods('new')); // 最新商品 $smarty->assign('hot_goods', get_recommend_goods('hot')); // 热点文章 $smarty->assign('promotion_goods', get_promote_goods()); // 特价商品 $smarty->assign('brand_list', get_brands()); $smarty->assign('promotion_info', get_promotion_info()); // 增加一个动态显示所有促销信息的标签栏 $smarty->assign('invoice_list', index_get_invoice_query()); // 发货查询
foreach ($res as $v) { $str[$v['cat_id']]['goods'] = assign_cat_goods($v['cat_id'], $num = 10, 'cate'); $mysql = "SELECT cat_id,cat_name FROM " . $GLOBALS['ecs']->table('category') . "WHERE parent_id = '" . $v['cat_id'] . "' AND is_show_cate = 1"; $result = $GLOBALS['db']->getAll($mysql); $cat_arr = array(); if ($result) { foreach ($result as $key => $val) { $cat_arr[$key]['url'] = build_uri('category', array('cid' => $val['cat_id']), $val['cat_name']); $cat_arr[$key]['cat_name'] = $val['cat_name']; } $str[$v['cat_id']]['category'] = $cat_arr; //子分类 } else { $str[$v['cat_id']]['category'] = ''; } $str[$v['cat_id']]['top'] = get_top10($v['cat_id'], 5); //分类排行 $str[$v['cat_id']]['name'] = $v['cat_name']; //分类名 $str[$v['cat_id']]['cat_id'] = $v['cat_id']; //分类id $str[$v['cat_id']]['url'] = build_uri('category', array('cid' => $v['cat_id']), $v['cat_name']); //分类id } $smarty->assign('cate_goods', $str); $smarty->display('category_top.dwt'); } /* zhong改下 */ /*------------------------------------------------------ */ //-- PRIVATE FUNCTION /*------------------------------------------------------ */
//print_r($properties['spe']); $smarty->assign('attribute_linked', get_same_attribute_goods($properties)); // 相同属性的关联商品 $smarty->assign('related_goods', $linked_goods); // 关联商品 $smarty->assign('goods_article_list', get_linked_articles($goods_id)); // 关联文章 $smarty->assign('fittings', get_goods_fittings(array($goods_id))); // 配件 $smarty->assign('rank_prices', get_user_rank_prices($goods_id, $shop_price)); // 会员等级价格 $smarty->assign('pictures', get_goods_gallery($goods_id)); // 商品相册 $smarty->assign('bought_goods', get_also_bought($goods_id)); // 购买了该商品的用户还购买了哪些商品 $smarty->assign('goods_rank', get_goods_rank($goods_id)); // 商品的销售排名 $smarty->assign('related_cat', get_related_cat($goods['cat_id'])); $smarty->assign('related_brand', get_related_brand($goods['cat_id'])); $smarty->assign('top10_brand', get_top10_brand($goods['brand_id'])); $smarty->assign('top10_category', get_top10($goods['cat_id'])); $smarty->assign('top10_price', get_top10_price($goods['shop_price'])); //by mike start //组合套餐名 $comboTabIndex = array(' ','一', '二', '三','四','五','六','七','八','九','十'); $smarty->assign('comboTab',$comboTabIndex); //组合套餐组 $fittings_list = get_goods_fittings(array($goods_id)); if(is_array($fittings_list)){ foreach($fittings_list as $vo){ $fittings_index[$vo['group_id']] = 1;//关联数组
return $ft->errorpage('Sorry, that corporation does not seem to exist.'); } # now get some interesting stats $stats = array(); $get = array('week' => this_week(), 'month' => this_month(), 'year' => this_year(), 'ever' => 0); foreach ($get as $when => $val) { $st = $ft->dbh->_select_row_as_assoc('SELECT * FROM tbl:stats WHERE type = "corp" AND var1 = ? AND dtype = ? AND var2 = ?', array($corpid, $when, $val)); $stats[$when] = $st; } # get various top 10s $ft->assign('t10weapons', get_top10('corp', $corpid, 'weapon')); $ft->assign('t10shipslost', get_top10('corp', $corpid, 'ship_lost')); $ft->assign('t10shipsdestroyed', get_top10('corp', $corpid, 'ship_killed')); $ft->assign('t10systems', get_top10('corp', $corpid, 'system')); $ft->assign('t10targets', get_top10('corp', $corpid, 'pilot')); $ft->assign('t10shipsflown', get_top10('corp', $corpid, 'ship_flown')); # get the last 50 final blows # $fbids = $ft->dbh->_select_column('SELECT killid FROM tbl:summary WHERE k_pilotid = ? AND type = "kill" ' . # 'ORDER BY killtime DESC LIMIT 10', array($pilotid)); # $fbs = load_kills_by_id($fbids); # us killing them $kids = $ft->dbh->_select_column('SELECT DISTINCT s.killid FROM tbl:killers k, tbl:summary s WHERE k.corpid = ? ' . 'AND s.killid = k.killid AND s.type = "kill" ' . 'ORDER BY s.killtime DESC LIMIT 10', array($corpid)); $ks = load_kills_by_id($kids); # us losing to them $lids = $ft->dbh->_select_column('SELECT DISTINCT killid FROM tbl:summary WHERE v_corpid = ? AND type = "loss" ' . 'ORDER BY killtime DESC LIMIT 10', array($corpid)); $ls = load_kills_by_id($lids); # them killing us (FOR THEIR SIDE) $xkids = $ft->dbh->_select_column('SELECT DISTINCT killid FROM tbl:summary WHERE k_corpid = ? AND type = "loss" ' . 'ORDER BY killtime DESC LIMIT 10', array($corpid)); $xks = load_kills_by_id($xkids); # us killing them (FOR THEIR SIDE) $xlids = $ft->dbh->_select_column('SELECT DISTINCT s.killid FROM tbl:killers k, tbl:summary s WHERE k_corpid = ? ' . 'AND s.killid = k.killid AND s.type = "kill" ' . 'ORDER BY s.killtime DESC LIMIT 10', array($corpid));
function get_on_top_goods($id, $num = 5) { $sql = 'SELECT cat_id,cat_name FROM ' . $GLOBALS['ecs']->table('category') . ' WHERE is_on_top = 1 AND parent_id =' . $id; $res = $GLOBALS['db']->getAll($sql); foreach ($res as $idx => $row) { $arr[$idx]['cat_url'] = build_uri('category', array('cid' => $row['cat_id']), $row['cat_name']); $arr[$idx]['cat_name'] = $row['cat_name']; $sql = 'SELECT cat_id,cat_name FROM ' . $GLOBALS['ecs']->table('category') . " WHERE parent_id = '{$row['cat_id']}' ORDER BY sort_order LIMIT 9 "; $child_cat_res = $GLOBALS['db']->getAll($sql); $child_cat = array(); $top_goods = array(); foreach ($child_cat_res as $key => $value) { $child_cat[$key]['cat_id'] = $value['cat_id']; $child_cat[$key]['cat_name'] = $value['cat_name']; $child_cat[$key]['url'] = build_uri('category', array('cid' => $value['cat_id']), $value['cat_name']); $top_goods[$key]['cat_name'] = $value['cat_name']; $top_goods[$key]['goods'] = get_top10($value['cat_id']); } $children = get_children($row['cat_id']); $sql = 'SELECT g.goods_id, g.goods_name, g.market_price, g.shop_price AS org_price, ' . "IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS shop_price, " . 'g.promote_price, promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, g.goods_img ' . "FROM " . $GLOBALS['ecs']->table('goods') . ' AS g ' . "LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp " . "ON mp.goods_id = g.goods_id AND mp.user_rank = '{$_SESSION['user_rank']}' " . 'WHERE g.is_on_sale = 1 AND g.is_alone_sale = 1 AND ' . 'g.is_delete = 0 AND (' . $children . ') '; $order_rule = 'ORDER BY g.sort_order, g.goods_id DESC'; $sql .= $order_rule; if ($num > 0) { $sql .= ' LIMIT ' . $num; } $goods_res = $GLOBALS['db']->getAll($sql); $goods = array(); foreach ($goods_res as $goods_idx => $goods_row) { if ($goods_row['promote_price'] > 0) { $promote_price = bargain_price($goods_row['promote_price'], $goods_row['promote_start_date'], $goods_row['promote_end_date']); $goods[$goods_idx]['promote_price'] = $promote_price > 0 ? price_format($promote_price) : ''; } else { $goods[$goods_idx]['promote_price'] = ''; } $goods[$goods_idx]['id'] = $goods_row['goods_id']; $goods[$goods_idx]['name'] = $goods_row['goods_name']; $goods[$goods_idx]['brief'] = $goods_row['goods_brief']; $goods[$goods_idx]['market_price'] = price_format($goods_row['market_price']); $goods[$goods_idx]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($goods_row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $goods_row['goods_name']; $goods[$goods_idx]['shop_price'] = price_format($goods_row['shop_price']); $goods[$goods_idx]['thumb'] = get_image_path($goods_row['goods_id'], $goods_row['goods_thumb'], true); $goods[$goods_idx]['goods_img'] = get_image_path($goods_row['goods_id'], $goods_row['goods_img']); $goods[$goods_idx]['url'] = build_uri('goods', array('gid' => $goods_row['goods_id']), $goods_row['goods_name']); } $arr[$idx]['goods'] = $goods; $arr[$idx]['child_cat'] = $child_cat; $arr[$idx]['top_goods'] = $top_goods; } return $arr; }
function action_view() { $smarty = $GLOBALS['smarty']; $db = $GLOBALS['db']; $ecs = $GLOBALS['ecs']; /* 取得参数:预售活动id */ $pre_sale_id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; if ($pre_sale_id <= 0) { ecs_header("Location: pre_sale.php\n"); exit; } /* 取得预售活动信息 */ $pre_sale = pre_sale_info($pre_sale_id); if (empty($pre_sale)) { ecs_header("Location: pre_sale.php\n"); exit; } // elseif ($pre_sale['is_on_sale'] == 0 || $pre_sale['is_alone_sale'] == 0) // { // header("Location: ./\n"); // exit; // } /* 评价数量 */ $pre_sale['comment_count'] = goods_comment_count($pre_sale['goods_id']); /* 累计销量 */ $pre_sale['sale_count'] = goods_sale_count($pre_sale['goods_id']); /* 赠送积分 */ $pre_sale['give_integral'] = $pre_sale['gift_integral']; /* 缓存id:语言,预售活动id,状态,(如果是进行中)当前数量和是否登录 */ $cache_id = $_CFG['lang'] . '-' . $pre_sale_id . '-' . $pre_sale['status']; // 活动进行中 if ($pre_sale['status'] == PSS_UNDER_WAY) { $cache_id = $cache_id . '-' . $pre_sale['valid_goods'] . '-' . intval($_SESSION['user_id'] > 0); } $cache_id = sprintf('%X', crc32($cache_id)); /* 如果没有缓存,生成缓存 */ if (!$smarty->is_cached('pre_sale_goods.dwt', $cache_id) || true) { $pre_sale['gmt_end_date'] = $pre_sale['end_date']; $smarty->assign('pre_sale', $pre_sale); /* 取得预售商品信息 */ $goods_id = $pre_sale['goods_id']; $goods = get_goods_info($goods_id); if (empty($goods)) { ecs_header("Location: pre_sale.php\n"); exit; } $goods['url'] = build_uri('goods', array('gid' => $goods_id), $goods['goods_name']); $goods = array_merge($goods, $pre_sale); $gift_integral = $pre_sale['gift_integral']; $goods['give_integral'] = $pre_sale['gift_integral']; // $parent_cat_id = get_parent_cat_id($goods['cat_id']); // $goods['child_cat'] = get_child_cat($parent_cat_id); // 相关分类 // $goods['get_cat_brands'] = get_cat_brands($parent_cat_id);; // 同类品牌 $smarty->assign('url', $_SERVER["REQUEST_URI"]); $smarty->assign('volume_price', $goods_volume_price); $smarty->assign('goods_id', $goods['goods_id']); $smarty->assign('promote_end_time', $goods['gmt_end_time']); $smarty->assign('helps', get_shop_help()); // 网店帮助 $smarty->assign('top_goods', get_top10()); // 销售排行 $smarty->assign('promotion_info', get_promotion_info()); // 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); // 评论数 // 评价晒单 增加 by www.68ecshop.com $rank_num['rank_a'] = $GLOBALS['db']->getOne("SELECT COUNT(*) AS num FROM " . $GLOBALS['ecs']->table('comment') . " WHERE id_value = '{$goods_id}' AND status = 1 AND comment_rank in (5,4)"); $rank_num['rank_b'] = $GLOBALS['db']->getOne("SELECT COUNT(*) AS num FROM " . $GLOBALS['ecs']->table('comment') . " WHERE id_value = '{$goods_id}' AND status = 1 AND comment_rank in (3,2)"); $rank_num['rank_c'] = $GLOBALS['db']->getOne("SELECT COUNT(*) AS num FROM " . $GLOBALS['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'] = $GLOBALS['db']->getOne("SELECT COUNT(*) AS num FROM " . $GLOBALS['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) { $v['tag_num'] = $GLOBALS['db']->getOne("SELECT COUNT(*) AS num FROM " . $GLOBALS['ecs']->table('comment') . " WHERE id_value = '{$goods_id}' AND status = 1 AND FIND_IN_SET({$v['tag_id']},comment_tag)"); $tag_arr[] = $v; } require_once 'includes/lib_comment.php'; $tag_arr = array_sort($tag_arr, 'tag_num', 'desc'); if ($tag_arr) { foreach ($tag_arr as $key => $val) { if ($_CFG['tag_show_num'] > 0) { if ($key + 1 <= $_CFG['tag_show_num']) { $comment_tags[] = $val; } } else { $comment_tags[] = $val; } } } $smarty->assign('comment_tags', $comment_tags); /* meta */ $smarty->assign('keywords', htmlspecialchars($goods['keywords'])); $smarty->assign('description', htmlspecialchars($goods['goods_brief'])); $goods['goods_style_name'] = add_style($goods['goods_name'], $goods['goods_name_style']); $smarty->assign('goods', $goods); $smarty->assign('goods_id', $goods['goods_id']); /* 取得商品的规格 */ $properties = get_goods_properties($goods_id); $smarty->assign('specification', $properties['spe']); // 商品规格 $smarty->assign('pictures', get_goods_gallery_attr_2($goods_id, $goods_attr_id)); // 商品相册 $smarty->assign('new_goods', get_recommend_goods('new')); // 最新商品 $smarty->assign('shop_country', $_CFG['shop_country']); /* 代码增加_start By www.ecshop68.com */ $sql_attr = "SELECT a.attr_id, ga.goods_attr_id FROM " . $GLOBALS['ecs']->table('attribute') . " AS a left join " . $GLOBALS['ecs']->table('goods_attr') . " AS ga on a.attr_id=ga.attr_id WHERE a.is_attr_gallery=1 and ga.goods_id='" . $goods_id . "' order by ga.goods_attr_id "; $goods_attr = $GLOBALS['db']->getRow($sql_attr); if ($goods_attr) { $goods_attr_id = $goods_attr['goods_attr_id']; $smarty->assign('attr_id', $goods_attr['attr_id']); } else { $smarty->assign('attr_id', 0); } $prod_exist_arr = array(); $sql_prod = "select goods_attr from " . $GLOBALS['ecs']->table('products') . " where product_number>0 and goods_id='{$goods_id}' order by goods_attr"; $res_prod = $GLOBALS['db']->query($sql_prod); while ($row_prod = $GLOBALS['db']->fetchRow($res_prod)) { $prod_exist_arr[] = "|" . $row_prod['goods_attr'] . "|"; } $smarty->assign('prod_exist_arr', $prod_exist_arr); // 模板赋值 $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']); // 当前位置 /* 代码增加_start By www.68ecshop.com */ $goods['supplier_name'] = "网站自营"; if ($goods['supplier_id'] > 0) { $sql_supplier = "SELECT s.supplier_id,s.supplier_name,s.add_time,sr.rank_name FROM " . $ecs->table("supplier") . " as s left join " . $ecs->table("supplier_rank") . " as sr ON s.rank_id=sr.rank_id WHERE s.supplier_id=" . $goods[supplier_id] . " AND s.status=1"; $shopuserinfo = $db->getRow($sql_supplier); $goods['supplier_name'] = $shopuserinfo['supplier_name']; get_dianpu_baseinfo($goods['supplier_id'], $shopuserinfo); } assign_dynamic('pre_sale_goods'); } // 更新商品点击次数 $sql = 'UPDATE ' . $GLOBALS['ecs']->table('goods') . ' SET click_count = click_count + 1 ' . "WHERE goods_id = '" . $pre_sale['goods_id'] . "'"; $GLOBALS['db']->query($sql); $smarty->assign('now_time', gmtime()); // 当前系统时间 $smarty->display('pre_sale_goods.dwt', $cache_id); }
return $ft->errorpage('Sorry, that pilot does not seem to exist.'); } # now get some interesting stats $stats = array(); $get = array('week' => this_week(), 'month' => this_month(), 'year' => this_year(), 'ever' => 0); foreach ($get as $when => $val) { $st = $ft->dbh->_select_row_as_assoc('SELECT * FROM tbl:stats WHERE type = "pilot" AND var1 = ? AND dtype = ? AND var2 = ?', array($pilotid, $when, $val)); $stats[$when] = $st; } # get various top 10s $ft->assign('t10weapons', get_top10('pilot', $pilotid, 'weapon')); $ft->assign('t10shipslost', get_top10('pilot', $pilotid, 'ship_lost')); $ft->assign('t10shipsdestroyed', get_top10('pilot', $pilotid, 'ship_killed')); $ft->assign('t10systems', get_top10('pilot', $pilotid, 'system')); $ft->assign('t10targets', get_top10('pilot', $pilotid, 'pilot')); $ft->assign('t10shipsflown', get_top10('pilot', $pilotid, 'ship_flown')); # get the last 50 final blows # $fbids = $ft->dbh->_select_column('SELECT killid FROM tbl:summary WHERE k_pilotid = ? AND type = "kill" ' . # 'ORDER BY killtime DESC LIMIT 10', array($pilotid)); # $fbs = load_kills_by_id($fbids); # us killing them $kids = $ft->dbh->_select_column('SELECT DISTINCT s.killid FROM tbl:killers k, tbl:summary s WHERE k.pilotid = ? ' . 'AND s.killid = k.killid AND s.type = "kill" ' . 'ORDER BY s.killtime DESC LIMIT 10', array($pilotid)); $ks = load_kills_by_id($kids); # us losing to them $lids = $ft->dbh->_select_column('SELECT DISTINCT killid FROM tbl:summary WHERE v_pilotid = ? AND type = "loss" ' . 'ORDER BY killtime DESC LIMIT 10', array($pilotid)); $ls = load_kills_by_id($lids); # them killing us (FOR THEIR SIDE) $xkids = $ft->dbh->_select_column('SELECT DISTINCT killid FROM tbl:summary WHERE k_pilotid = ? AND type = "loss" ' . 'ORDER BY killtime DESC LIMIT 10', array($pilotid)); $xks = load_kills_by_id($xkids); # us killing them (FOR THEIR SIDE) $xlids = $ft->dbh->_select_column('SELECT DISTINCT s.killid FROM tbl:killers k, tbl:summary s WHERE v_pilotid = ? ' . 'AND s.killid = k.killid AND s.type = "kill" ' . 'ORDER BY s.killtime DESC LIMIT 10', array($pilotid));