示例#1
0
define('IN_ECS', true);
define('LIMIT_NUM', 8);
require dirname(__FILE__) . '/includes/init.php';
require_once ROOT_PATH . '/includes/lib_common.php';
require_once ROOT_PATH . '/includes/cls_template.php';
if ((DEBUG_MODE & 2) != 2) {
    //$smarty->caching = true;
}
$cache_id = sprintf('%X', crc32('newyear' . '-' . $_CFG['lang']));
if (!$smarty->is_cached('newyear.dwt', $cache_id)) {
    $sql = "SELECT * FROM " . $GLOBALS['ecs']->table('favourable_activity') . " where act_name like '周年庆%' ORDER BY sort_order DESC LIMIT 2";
    $newyearActivty = $GLOBALS['db']->getAll($sql);
    foreach ($newyearActivty as $key => $val) {
        $goods = getGoods(array('firterType' => $val['act_range'], 'firterVal' => $val['act_range_ext']));
        setSomeGoodsValue($goods, array('discountType' => $val['act_type'], 'discountVal' => $val['act_type_ext']));
        $newyearActivty[$key]['goods'] = $goods;
    }
    assign_template();
    $smarty->assign('keywords', htmlspecialchars($_CFG['shop_keywords']));
    $smarty->assign('description', htmlspecialchars($_CFG['shop_desc']));
    $smarty->assign('categories', get_categories_tree(0));
    // 分类树
    $smarty->assign('newyearActivty', $newyearActivty);
}
$smarty->display('newyear.dwt', $cache_id);
function setSomeGoodsValue(&$goods, $dsct)
{
    $dsct['discountVal'] = floatval($dsct['discountVal']);
    if ($dsct['discountType'] == 2) {
        if ($dsct['discountVal'] > 100 || $dsct['discountVal'] < 0) {
示例#2
0
<?php

define('IN_ECS', true);
define('LIMIT_NUM', 8);
require dirname(__FILE__) . '/includes/init.php';
require_once ROOT_PATH . '/includes/lib_common.php';
require_once ROOT_PATH . '/includes/cls_template.php';
if ((DEBUG_MODE & 2) != 2) {
    //	$smarty->caching = true;
}
$cache_id = sprintf('%X', crc32('shangou' . '-' . $_CFG['lang']));
if (!$smarty->is_cached('shangou.dwt', $cache_id)) {
    $shangouActivty = getShangouActivty();
    foreach ($shangouActivty as $key => $val) {
        $goods = getGoods(array('firterType' => $val['act_range'], 'firterVal' => $val['act_range_ext']));
        setSomeGoodsValue($goods, array('discountType' => $val['act_type'], 'discountVal' => $val['act_type_ext']), $shangouActivty[$key]);
        setActivtyDate($shangouActivty[$key]);
        $shangouActivty[$key]['goods'] = $goods;
    }
    $smarty->assign('shangouActivty', $shangouActivty);
    assign_template();
    $smarty->assign('categories', get_categories_tree_pro());
    // 分类树
    $smarty->assign('helps', get_shop_help());
    // 网店帮助
}
$smarty->display('shangou.dwt', $cache_id);
function getShangouActivty()
{
    $yesterdayTwentyTwoClock = getSpecificTime(-2);
    $todayTwentyTwoClock = getSpecificTime(22);