$best_num = count($best_goods); $smarty->assign('best_num', $best_num); if ($best_num > 0) { $i = 0; foreach ($best_goods as $key => $best_data) { $best_goods[$key]['shop_price'] = encode_output($best_data['shop_price']); $best_goods[$key]['name'] = encode_output($best_data['name']); /*if ($i > 2) { break; }*/ $i++; } $smarty->assign('best_goods', $best_goods); } $promote_goods = get_promote_goods(); $promote_num = count($promote_goods); $smarty->assign('promote_num', $promote_num); if ($promote_num > 0) { $i = 0; foreach ($promote_goods as $key => $promote_data) { $promote_goods[$key]['shop_price'] = encode_output($promote_data['shop_price']); $promote_goods[$key]['name'] = encode_output($promote_data['name']); /*if ($i > 2) { break; }*/ $i++; } $smarty->assign('promote_goods', $promote_goods); }
// 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('group_buy_goods', index_get_group_buy()); // 团购商品 $smarty->assign('auction_list', index_get_auction()); // 拍卖活动 $smarty->assign('shop_notice', $_CFG['shop_notice']); // 商店公告 /* 首页主广告设置 */
function getPromoteGoods() { return get_promote_goods(); }
$arr['all'] = array('brand_id' => 0, 'brand_name' => $GLOBALS['_LANG']['all_goods'], 'brand_logo' => '', 'goods_num' => '', 'url' => build_uri('category', array('cid' => $cat_id))); } else { $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()); /* 调查 */ $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_promote_goods($cat_id, 3)); $smarty->assign('hot_goods', get_category_recommend_goods('hot', $children, $brand, $price_min, $price_max, $ext, 6)); $sql = "SELECT cat_id,cat_name FROM " . $GLOBALS['ecs']->table('category') . "WHERE parent_id = '{$cat_id}' AND is_show_cate = 1 ORDER BY sort_order"; $res = $GLOBALS['db']->getAll($sql); 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; //子分类
<?php $GLOBALS['smarty']->assign('top_cat_name1', $GLOBALS['cat']['cat_name'] . "频道"); $GLOBALS['smarty']->assign('top_cat_name2', $GLOBALS['cat']['cat_name']); $GLOBALS['smarty']->assign('cat_id', $GLOBALS['cat_id']); $GLOBALS['smarty']->assign('topcat_info', get_topcat_info($GLOBALS['cat_id'])); $GLOBALS['smarty']->assign('flash_img_list', get_flash_img($GLOBALS['cat_id'])); $GLOBALS['smarty']->assign('subcat_list', get_subcat_list($GLOBALS['cat_id'])); $children = get_children($GLOBALS['cat_id']); $GLOBALS['smarty']->assign('goods_list_new', get_catindex_recommend_goods('new', $children)); $GLOBALS['smarty']->assign('goods_list_best', get_catindex_recommend_goods('best', $children)); $GLOBALS['smarty']->assign('goods_list_hot', get_catindex_recommend_goods('hot', $children)); $GLOBALS['smarty']->assign('promotion_goods', get_promote_goods($GLOBALS['cat_id'])); $GLOBALS['smarty']->assign('childcat_goods', get_childcat_goods($GLOBALS['cat_id'])); $GLOBALS['smarty']->assign('get_pro_top', get_pro_top10($GLOBALS['cat_id'])); //$GLOBALS['smarty']->display('category_index.dwt',$GLOBALS['cache_id']); function http() { return isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off' ? 'https://' : 'http://'; } function get_domain() { $protocol = http(); if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) { $host = $_SERVER['HTTP_X_FORWARDED_HOST']; } elseif (isset($_SERVER['HTTP_HOST'])) { $host = $_SERVER['HTTP_HOST']; } else { if (isset($_SERVER['SERVER_PORT'])) { $port = ':' . $_SERVER['SERVER_PORT']; if (':80' == $port && 'http://' == $protocol || ':443' == $port && 'https://' == $protocol) {