require_once('phplib/mobile_redirect.php');
require_once('phplib/common.php');
require_once('phplib/template.php');
require_once('phplib/product_lib.php');
// 2015/05/19 Dragoon. Hannah 提出轉址需求
// start
//if ($_SERVER["REQUEST_URI"] == "/shakingtea") {
// header("Location: http://gift.teascovery.com/brand.php?id=TC");
// die();
//}
// end
mysql_open();
$condition = array();
foreach($TEASCOVERY_CHOICE as $tc) {
$condition[] = "FIND_IN_SET('" . addslashes($tc) . "', `group`)";
}
$sql = "SELECT `id`, `name`, `brand`, `group` FROM `products` WHERE `enable`=1 AND (" . implode(' OR ', $condition) . ")";
$teascovery_choice = mysql_fetch_all($sql);
shuffle($teascovery_choice);
$sql = "SELECT `item`.`product_id` as `id`, SUM(`item`.`product_count`) as `sold_count`, `products`.`name`, `products`.`brand` FROM `item` LEFT JOIN `products` ON `products`.`id`=`item`.`product_id` WHERE `products`.`enable`=1 AND `item`.`time`>'" . GetTime(-1 * HOT_SELL_PERIOD * 30 * 24 * 60) . "' GROUP BY `item`.`product_id` ORDER BY `sold_count` DESC LIMIT 5";
$hot_sell = mysql_fetch_all($sql);
$sql = "SELECT `id`, `title`, `sub_title` FROM `teantertain` WHERE `enable`=1 ORDER BY `date` DESC, `id` DESC LIMIT 1";
$teantertain = mysql_fetch_one($sql);
$sql = "SELECT `id`, `name`, `brand` FROM `products` WHERE `enable`=1 AND FIND_IN_SET('喝茶好伴侶', `group`)";
$tea_pal = mysql_fetch_all($sql);
shuffle($tea_pal);
$tea_pal = array_slice($tea_pal, 0, 4);
$new_brand = array();
$ad_brand = array();
foreach($BRAND as $brand => $brand_data) {
if($brand_data['enable'] == 1) {
if($brand_data['new'] == 1) {
$new_brand[] = $brand;
}
if($brand_data['ad'] == 1) {
$ad_brand[] = $brand;
}
}
}
shuffle($new_brand);
shuffle($ad_brand);
// 首頁大圖 ------------
$sql = "SELECT `id`, `campaign`, `url` FROM `promotion` WHERE `main_page_slide`=1 AND `enable`=1 AND ('" . date("Y-m-d") . "' BETWEEN `start_date` AND `end_date`) ORDER BY `main_page_slide_order` DESC, `start_date` DESC, `id`";
$slide = mysql_fetch_all($sql);
$slide_img = array();
foreach($slide as $s) {
$path = "images/promotion/{$s['id']}/slide";
foreach(array('.png', '.jpg', '.gif') as $ext) {
$file = $path . $ext;
if(file_exists($file)) {
$slide_img[] = array($file, $s['campaign'], $s['url']);
for($i = 1; $i < 10; $i++) {
$file = $path . "_" . $i . $ext;
if(! file_exists($file)) break;
$slide_img[] = array($file, $s['campaign'], $s['url']);
}
}
}
}
// --------------------
$config = get_config();
mysql_close();
html_header_1('', array(/*'jslib/fancybox/jquery.fancybox-1.3.4.pack.js', */'home.js'), array(/*'jslib/fancybox/jquery.fancybox-1.3.4.css', */'home.css'));
?>
html_upstartdna();
html_header_2();
?>
/*
發現茶禮王
*/ ?>
茶葉新手專區
|
新手上路 Q&A
|
/* */ ?>
foreach($slide_img as $s) { ?>
![]()
} ?>
茶葉新品上架
foreach($new_brand as $brand) { ?>

} ?>
精選茶葉禮盒
foreach($ad_brand as $brand) { ?>

} ?>
發現茶 30秒冷泡茶
foreach($TEASCOVERY_CHOICE as $i => $choice) { ?>
} ?>
foreach($TEASCOVERY_CHOICE as $i => $choice) { ?>