コード例 #1
0
ファイル: index.php プロジェクト: shiruolin/hzzshop
function get_cat_id_goods_list($cat_id = '', $num = '', $ext = '')
{
    $sql = 'Select g.goods_id,g.guige, g.cat_id,c.parent_id, g.goods_name, g.goods_number, g.goods_name_style, g.market_price, g.shop_price AS org_price, g.promote_price, ' . "IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS shop_price, " . "promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, goods_img, " . "g.is_best, g.is_new, g.is_hot, g.is_promote,b.brand_name " . 'FROM ' . $GLOBALS['hhs']->table('goods') . ' AS g ' . 'LEFT JOIN ' . $GLOBALS['hhs']->table('category') . ' AS c ON c.cat_id = g.cat_id ' . "LEFT JOIN " . $GLOBALS['hhs']->table('member_price') . " AS mp " . "ON mp.goods_id = g.goods_id AND mp.user_rank = '{$_SESSION['user_rank']}' " . " left join " . $GLOBALS['hhs']->table('brand') . " as b on g.brand_id=b.brand_id " . " Where g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_new = 1 AND g.is_delete = 0 and g.is_mall=1 " . ($sql .= " AND (c.parent_id =" . $cat_id . " OR g.cat_id = " . $cat_id . " OR g.cat_id " . db_create_in(array_unique(array_merge(array($cat_id), array_keys(cat_list($cat_id, 0, false))))) . ")");
    $sql .= $ext;
    $sql .= " LIMIT {$num}";
    $res = $GLOBALS['db']->getAll($sql);
    $goods = array();
    foreach ($res as $idx => $row) {
        $goods[$idx]['id'] = $row['goods_id'];
        $goods[$idx]['name'] = $row['goods_name'];
        $goods[$idx]['guige'] = $row['guige'];
        $goods[$idx]['brief'] = $row['goods_brief'];
        $goods[$idx]['brand_name'] = $row['brand_name'];
        $goods[$idx]['goods_number'] = $row['goods_number'];
        $goods[$idx]['goods_style_name'] = add_style($row['goods_name'], $row['goods_name_style']);
        $goods[$idx]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
        $goods[$idx]['short_style_name'] = add_style($goods[$idx]['short_name'], $row['goods_name_style']);
        $goods[$idx]['market_price'] = price_format($row['market_price']);
        $goods[$idx]['shop_price'] = price_format($row['shop_price']);
        $goods[$idx]['thumb'] = empty($row['goods_thumb']) ? $GLOBALS['_CFG']['no_picture'] : $row['goods_thumb'];
        $goods[$idx]['goods_img'] = empty($row['goods_img']) ? $GLOBALS['_CFG']['no_picture'] : $row['goods_img'];
        $goods[$idx]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);
        if ($GLOBALS['SID']) {
            $goods[$idx]['shop_price'] = price_format($row['s_goods_price']);
        }
    }
    return $goods;
}
コード例 #2
0
ファイル: lib_ecmoban.php プロジェクト: u0mo5/app
/**
 * 获得指定分类同级的所有分类以及该分类下的子分类
 *
 * @access  public
 * @param   integer     $cat_id     分类编号
 * @return  array
 */
function get_categories_tree_pro($cat_id = 0)
{
    if ($cat_id > 0) {
        $sql = 'SELECT parent_id FROM ' . $GLOBALS['ecs']->table('category') . " WHERE cat_id = '{$cat_id}'";
        $parent_id = $GLOBALS['db']->getOne($sql);
    } else {
        $parent_id = 0;
    }
    /*
     判断当前分类中全是是否是底级分类,
     如果是取出底级分类上级分类,
     如果不是取当前分类及其下的子分类
    */
    $sql = 'SELECT count(*) FROM ' . $GLOBALS['ecs']->table('category') . " WHERE parent_id = '{$parent_id}' AND is_show = 1 ";
    if ($GLOBALS['db']->getOne($sql) || $parent_id == 0) {
        /* 获取当前分类及其子分类 */
        $sql = 'SELECT cat_id,cat_name ,parent_id,is_show ' . 'FROM ' . $GLOBALS['ecs']->table('category') . "WHERE parent_id = '{$parent_id}' AND is_show = 1 ORDER BY sort_order ASC, cat_id ASC";
        $res = $GLOBALS['db']->getAll($sql);
        foreach ($res as $row) {
            $cat_id = $row['cat_id'];
            $children = get_children($cat_id);
            $cat = $GLOBALS['db']->getRow('SELECT cat_name, keywords, cat_desc, style, grade, filter_attr, parent_id FROM ' . $GLOBALS['ecs']->table('category') . " WHERE cat_id = '{$cat_id}'");
            /* 获取分类下文章 */
            $sql = 'SELECT a.article_id, a.title, ac.cat_name, a.add_time, a.file_url, a.open_type FROM ' . $GLOBALS['ecs']->table('article_cat') . ' AS ac RIGHT JOIN ' . $GLOBALS['ecs']->table('article') . " AS a ON a.cat_id=ac.cat_id AND a.is_open = 1 WHERE ac.cat_name='{$row['cat_name']}' ORDER BY a.article_type,a.article_id DESC LIMIT 4 ";
            $articles = $GLOBALS['db']->getAll($sql);
            foreach ($articles as $key => $val) {
                $articles[$key]['url'] = $val['open_type'] != 1 ? build_uri('article', array('aid' => $val['article_id']), $val['title']) : trim($val['file_url']);
            }
            /* 获取分类下品牌 */
            $sql = "SELECT b.brand_id, b.brand_name,  b.brand_logo, COUNT(*) AS goods_num, IF(b.brand_logo > '', '1', '0') AS tag " . "FROM " . $GLOBALS['ecs']->table('brand') . "AS b, " . $GLOBALS['ecs']->table('goods') . " AS g LEFT JOIN " . $GLOBALS['ecs']->table('goods_cat') . " AS gc ON g.goods_id = gc.goods_id " . "WHERE g.brand_id = b.brand_id AND ({$children} OR " . 'gc.cat_id ' . db_create_in(array_unique(array_merge(array($cat_id), array_keys(cat_list($cat_id, 0, false))))) . ") AND b.is_show = 1 " . " AND g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 " . "GROUP BY b.brand_id HAVING goods_num > 0 ORDER BY b.sort_order, b.brand_id ASC";
            $brands = $GLOBALS['db']->getAll($sql);
            foreach ($brands as $key => $val) {
                $temp_key = $key + 1;
                $brands[$temp_key]['brand_name'] = $val['brand_name'];
                $brands[$temp_key]['url'] = build_uri('category', array('cid' => $cat_id, 'bid' => $val['brand_id'], 'price_min' => $price_min, 'price_max' => $price_max, 'filter_attr' => $filter_attr_str), $cat['cat_name']);
                /* 判断品牌是否被选中 */
                if ($brand == $brands[$key]['brand_id']) {
                    $brands[$temp_key]['selected'] = 1;
                } else {
                    $brands[$temp_key]['selected'] = 0;
                }
            }
            unset($brands[0]);
            $cat_arr[$row['cat_id']]['brands'] = $brands;
            $cat_arr[$row['cat_id']]['articles'] = $articles;
            if ($row['is_show']) {
                $cat_arr[$row['cat_id']]['id'] = $row['cat_id'];
                $cat_arr[$row['cat_id']]['name'] = $row['cat_name'];
                $cat_arr[$row['cat_id']]['url'] = build_uri('category', array('cid' => $row['cat_id']), $row['cat_name']);
                if (isset($row['cat_id']) != NULL) {
                    $cat_arr[$row['cat_id']]['cat_id'] = get_child_tree_pro($row['cat_id']);
                }
            }
        }
    }
    if (isset($cat_arr)) {
        return $cat_arr;
    }
}
コード例 #3
0
function write_add_item()
{
    global $_POST;
    extract($_POST);
    global $_SESSION;
    db_connect();
    $write_sql = "INSERT INTO auditor_report (cat,detail,date_added,user_added)\n\t\t\t\t\tVALUES ('{$cat}','{$detail}','now','{$_SESSION['USER_NAME']}')";
    $run_write = db_exec($write_sql) or errDie("Unable to add report detail");
    return cat_list();
}
コード例 #4
0
ファイル: lib_common.php プロジェクト: reake/share-travel
function cat_list($parent_id = 0, $level = 0)
{
    global $db, $prefix;
    $cat_list = array();
    $rows = $db->get_all("SELECT * FROM {$prefix}category WHERE parent_id = ? ORDER BY sort_order", array($parent_id));
    foreach ($rows as $row) {
        $row['level'] = $level;
        $cat_list[] = $row;
        $cat_list = array_merge($cat_list, cat_list($row['id'], $level + 1));
    }
    return $cat_list;
}
コード例 #5
0
 /**
  * 编辑分类信息
  */
 public function edit()
 {
     if (IS_POST) {
         $cat_id = I('cat_id');
         $cat_info = I('data');
         /* 数据验证 */
         $msg = Check::rule(array(array(Check::must($cat_info['cat_name']), L('catname_empty'))));
         /* 提示信息 */
         if ($msg !== true) {
             $this->message($msg, NULL, 'error');
         }
         /* 判断上级目录是否合法 */
         $children = array_keys(cat_list($cat_id, 0, false));
         // 获得当前分类的所有下级分类
         if (in_array($cat_info['parent_id'], $children)) {
             $this->message(L('is_leaf_error'), NULL, 'error');
         }
         /* 更新栏目 */
         $this->cat_update($cat_id, $cat_info);
         /* 更新栏目图标 */
         if ($_FILES['cat_image']['name']) {
             /* cat_image图标 */
             $result = $this->ectouchUpload('cat_image', 'cat_image');
             if ($result['error'] > 0) {
                 $this->message($result['message'], NULL, 'error');
             }
             $data['cat_image'] = substr($result['message']['cat_image']['savepath'], 2) . $result['message']['cat_image']['savename'];
             $this->model->table('touch_category')->data($data)->where('cat_id=' . $cat_id)->update();
         }
         /* 清除缓存 */
         clear_all_files();
         $this->message(L('catedit_succed'), url('index'));
     }
     $cat_id = I('cat_id');
     //查询附表信息
     $result = $this->model->table('touch_category')->where('cat_id=' . $cat_id)->find();
     if (empty($result)) {
         $data['cat_id'] = $cat_id;
         $this->model->table('touch_category')->data($data)->insert();
     }
     // 查询分类信息数据
     $cat_info = $this->get_cat_info($cat_id);
     /* 模板赋值 */
     $this->assign('ur_here', L('category_edit'));
     $this->assign('cat_info', $cat_info);
     $this->assign('cat_select', cat_list(0, $cat_info['parent_id'], true));
     $this->display();
 }
コード例 #6
0
ファイル: goodbindcard.php プロジェクト: nanhuacrab/ecshop
function category_get_goods22()
{
    $where = "g.is_on_sale = 1 and g.is_bind_card='2' AND g.is_alone_sale = 1 AND " . "g.is_delete = 0  ";
    $id = isset($_REQUEST['id']) ? trim($_REQUEST['id']) : 0;
    if ($id) {
        $where .= " and g.cat_id " . db_create_in(array_unique(array_keys(cat_list($id, 0, false))));
    }
    /* 获得商品列表 */
    $sql = 'SELECT g.goods_id, g.goods_name,g.cat_id, g.goods_name_style, g.market_price, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, ' . "IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS shop_price, g.promote_price, g.goods_type, " . 'g.promote_start_date, g.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 {$where} ";
    $goodlist = $GLOBALS['db']->getAll($sql);
    $arr = array();
    foreach ($goodlist as $row) {
        if ($row['promote_price'] > 0) {
            $promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']);
        } else {
            $promote_price = 0;
        }
        /* 处理商品水印图片 */
        $watermark_img = '';
        if ($promote_price != 0) {
            $watermark_img = "watermark_promote_small";
        } elseif ($row['is_new'] != 0) {
            $watermark_img = "watermark_new_small";
        } elseif ($row['is_best'] != 0) {
            $watermark_img = "watermark_best_small";
        } elseif ($row['is_hot'] != 0) {
            $watermark_img = 'watermark_hot_small';
        }
        if ($watermark_img != '') {
            $arr[$row['goods_id']]['watermark_img'] = $watermark_img;
        }
        $arr[$row['goods_id']]['goods_id'] = $row['goods_id'];
        $arr[$row['goods_id']]['goods_name'] = $row['goods_name'];
        $arr[$row['goods_id']]['name'] = $row['goods_name'];
        $arr[$row['goods_id']]['goods_brief'] = $row['goods_brief'];
        $arr[$row['goods_id']]['goods_style_name'] = add_style($row['goods_name'], $row['goods_name_style']);
        $arr[$row['goods_id']]['market_price'] = price_format($row['market_price']);
        $arr[$row['goods_id']]['shop_price'] = price_format($row['shop_price']);
        $arr[$row['goods_id']]['type'] = $row['goods_type'];
        $arr[$row['goods_id']]['promote_price'] = $promote_price > 0 ? price_format($promote_price) : '';
        $arr[$row['goods_id']]['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);
        $arr[$row['goods_id']]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']);
        $arr[$row['goods_id']]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']);
    }
    return $arr;
}
コード例 #7
0
ファイル: topic.php プロジェクト: netroby/ecshop
    $smarty->assign($sort_flag['tag'], $sort_flag['img']);
    assign_query_info();
    $smarty->assign('action_link', array('text' => $_LANG['topic_add'], 'href' => 'topic.php?act=add'));
    $smarty->display('topic_list.htm');
}
/* 添加,编辑 */
if ($_REQUEST['act'] == 'add' || $_REQUEST['act'] == 'edit') {
    admin_priv('topic_manage');
    $isadd = $_REQUEST['act'] == 'add';
    $smarty->assign('isadd', $isadd);
    $topic_id = empty($_REQUEST['topic_id']) ? 0 : intval($_REQUEST['topic_id']);
    include_once ROOT_PATH . 'includes/fckeditor/fckeditor.php';
    // 包含 html editor 类文件
    $smarty->assign('ur_here', $_LANG['09_topic']);
    $smarty->assign('action_link', list_link($isadd));
    $smarty->assign('cat_list', cat_list(0, 1));
    $smarty->assign('brand_list', get_brand_list());
    $smarty->assign('cfg_lang', $_CFG['lang']);
    $smarty->assign('topic_style_color', $topic_style_color);
    $width_height = get_toppic_width_height();
    if (isset($width_height['pic']['width']) && isset($width_height['pic']['height'])) {
        $smarty->assign('width_height', sprintf($_LANG['tips_width_height'], $width_height['pic']['width'], $width_height['pic']['height']));
    }
    if (isset($width_height['title_pic']['width']) && isset($width_height['title_pic']['height'])) {
        $smarty->assign('title_width_height', sprintf($_LANG['tips_title_width_height'], $width_height['title_pic']['width'], $width_height['title_pic']['height']));
    }
    if (!$isadd) {
        $sql = 'SELECT * FROM ' . $ecs->table('topic') . " WHERE topic_id = '{$topic_id}'";
        $topic = $db->getRow($sql);
        $topic['start_time'] = local_date('Y-m-d', $topic['start_time']);
        $topic['end_time'] = local_date('Y-m-d', $topic['end_time']);
コード例 #8
0
ファイル: lib_goods.php プロジェクト: shaoslu/jumei
/**
 * 获得指定分类同级的所有分类以及该分类下的子分类
 *
 * @access  public
 * @param   integer     $cat_id     分类编号
 * @return  array
 */
function get_categories_tree($cat_id = 0)
{
    if ($cat_id > 0) {
        $sql = 'SELECT parent_id FROM ' . $GLOBALS['ecs']->table('category') . " WHERE cat_id = '{$cat_id}'";
        $parent_id = $GLOBALS['db']->getOne($sql);
    } else {
        $parent_id = 0;
    }
    /*
     判断当前分类中全是是否是底级分类,
     如果是取出底级分类上级分类,
     如果不是取当前分类及其下的子分类
    */
    $sql = 'SELECT count(*) FROM ' . $GLOBALS['ecs']->table('category') . " WHERE parent_id = '{$parent_id}' AND is_show = 1 ";
    if ($GLOBALS['db']->getOne($sql) || $parent_id == 0) {
        /* 获取当前分类及其子分类 */
        $sql = 'SELECT cat_id,cat_name ,parent_id,is_show ' . 'FROM ' . $GLOBALS['ecs']->table('category') . "WHERE parent_id = '{$parent_id}' AND is_show = 1 ORDER BY sort_order ASC, cat_id ASC";
        $res = $GLOBALS['db']->getAll($sql);
        foreach ($res as $row) {
            $cat_id = $row['cat_id'];
            $children = get_children($cat_id);
            /* 获取分类下品牌 */
            $sql = "SELECT b.brand_id, b.brand_logo,b.brand_name, COUNT(*) AS goods_num " . "FROM " . $GLOBALS['ecs']->table('brand') . "AS b, " . $GLOBALS['ecs']->table('goods') . " AS g LEFT JOIN " . $GLOBALS['ecs']->table('goods_cat') . " AS gc ON g.goods_id = gc.goods_id " . "WHERE g.brand_id = b.brand_id AND ({$children} OR " . 'gc.cat_id ' . db_create_in(array_unique(array_merge(array($cat_id), array_keys(cat_list($cat_id, 0, false))))) . ") AND b.is_show = 1 " . " AND g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 " . "GROUP BY b.brand_id HAVING goods_num > 0 ORDER BY b.sort_order, b.brand_id ASC";
            $brands = $GLOBALS['db']->getAll($sql);
            foreach ($brands as $key => $val) {
                $brands[$key]['logo'] = $val['brand_logo'];
                $brands[$key]['brand_name'] = $val['brand_name'];
                $brands[$key]['url'] = build_uri('category', array('cid' => $cat_id, 'bid' => $val['brand_id'], 'price_min' => $price_min, 'price_max' => $price_max, 'filter_attr' => $filter_attr_str), $cat['cat_name']);
                /* 判断品牌是否被选中 */
                if ($brand == $brands[$key]['brand_id']) {
                    $brands[$key]['selected'] = 1;
                } else {
                    $brands[$key]['selected'] = 0;
                }
            }
            $cat_arr[$row['cat_id']]['brands'] = $brands;
            $cat_arr[$row['cat_id']]['articles'] = $articles;
            if ($row['is_show']) {
                $cat_arr[$row['cat_id']]['id'] = $row['cat_id'];
                $cat_arr[$row['cat_id']]['name'] = $row['cat_name'];
                $cat_arr[$row['cat_id']]['url'] = build_uri('category', array('cid' => $row['cat_id']), $row['cat_name']);
                if (isset($row['cat_id']) != NULL) {
                    $cat_arr[$row['cat_id']]['cat_id'] = get_child_tree($row['cat_id']);
                }
            }
        }
    }
    if (isset($cat_arr)) {
        return $cat_arr;
    }
}
コード例 #9
0
ファイル: lib_order.php プロジェクト: dlpc/ecshop
/**
 * 计算购物车中的商品能享受红包支付的总额
 * @return  float   享受红包支付的总额
 */
function compute_discount_amount()
{
    /* 查询优惠活动 */
    $now = gmtime();
    $user_rank = ',' . $_SESSION['user_rank'] . ',';
    $sql = "SELECT *" . "FROM " . $GLOBALS['ecs']->table('favourable_activity') . " WHERE start_time <= '{$now}'" . " AND end_time >= '{$now}'" . " AND CONCAT(',', user_rank, ',') LIKE '%" . $user_rank . "%'" . " AND act_type " . db_create_in(array(FAT_DISCOUNT, FAT_PRICE));
    $favourable_list = $GLOBALS['db']->getAll($sql);
    if (!$favourable_list) {
        return 0;
    }
    /* 查询购物车商品 */
    $sql = "SELECT c.goods_id, c.goods_price * c.goods_number AS subtotal, g.cat_id, g.brand_id " . "FROM " . $GLOBALS['ecs']->table('cart') . " AS c, " . $GLOBALS['ecs']->table('goods') . " AS g " . "WHERE c.goods_id = g.goods_id " . "AND c.session_id = '" . SESS_ID . "' " . "AND c.parent_id = 0 " . "AND c.is_gift = 0 " . "AND rec_type = '" . CART_GENERAL_GOODS . "'";
    $goods_list = $GLOBALS['db']->getAll($sql);
    if (!$goods_list) {
        return 0;
    }
    /* 初始化折扣 */
    $discount = 0;
    $favourable_name = array();
    /* 循环计算每个优惠活动的折扣 */
    foreach ($favourable_list as $favourable) {
        $total_amount = 0;
        if ($favourable['act_range'] == FAR_ALL) {
            foreach ($goods_list as $goods) {
                $total_amount += $goods['subtotal'];
            }
        } elseif ($favourable['act_range'] == FAR_CATEGORY) {
            /* 找出分类id的子分类id */
            $id_list = array();
            $raw_id_list = explode(',', $favourable['act_range_ext']);
            foreach ($raw_id_list as $id) {
                $id_list = array_merge($id_list, array_keys(cat_list($id, 0, false)));
            }
            $ids = join(',', array_unique($id_list));
            foreach ($goods_list as $goods) {
                if (strpos(',' . $ids . ',', ',' . $goods['cat_id'] . ',') !== false) {
                    $total_amount += $goods['subtotal'];
                }
            }
        } elseif ($favourable['act_range'] == FAR_BRAND) {
            foreach ($goods_list as $goods) {
                if (strpos(',' . $favourable['act_range_ext'] . ',', ',' . $goods['brand_id'] . ',') !== false) {
                    $total_amount += $goods['subtotal'];
                }
            }
        } elseif ($favourable['act_range'] == FAR_GOODS) {
            foreach ($goods_list as $goods) {
                if (strpos(',' . $favourable['act_range_ext'] . ',', ',' . $goods['goods_id'] . ',') !== false) {
                    $total_amount += $goods['subtotal'];
                }
            }
        } else {
            continue;
        }
        if ($total_amount > 0 && $total_amount >= $favourable['min_amount'] && ($total_amount <= $favourable['max_amount'] || $favourable['max_amount'] == 0)) {
            if ($favourable['act_type'] == FAT_DISCOUNT) {
                $discount += $total_amount * (1 - $favourable['act_type_ext'] / 100);
            } elseif ($favourable['act_type'] == FAT_PRICE) {
                $discount += $favourable['act_type_ext'];
            }
        }
    }
    return $discount;
}
コード例 #10
0
    /**
     *  所有的促销活动信息
     * @access  public
     * @return  array
     */
    function get_promotion_show($goods_id = '') {
        $group = array();
        $package = array();
        $favourable = array();
        $gmtime = gmtime();
        $sql = 'SELECT act_id, act_name, act_type, start_time, end_time FROM ' . $this->pre . "goods_activity WHERE is_finished=0 AND start_time <= '$gmtime' AND end_time >= '$gmtime'";
        if (!empty($goods_id)) {
            $sql .= " AND goods_id = '$goods_id'";
        }
        $res = $this->query($sql);
        if (is_array($res))
            foreach ($res as $data) {
                switch ($data['act_type']) {
                    case GAT_GROUP_BUY: //团购 
                        $group[$data['act_id']]['type'] = 'group_buy';
                        break;
                    case GAT_PACKAGE: //礼包
                        $package[$data['act_id']]['type'] = 'package';
                        break;
                }
            }

        $user_rank = ',' . $_SESSION['user_rank'] . ',';
        $favourable = array();
        $sql = 'SELECT act_id, act_range, act_type,act_range_ext, act_name, start_time, end_time FROM ' . $this->pre . "favourable_activity WHERE start_time <= '$gmtime' AND end_time >= '$gmtime'";
        if (!empty($goods_id)) {
            $sql .= " AND CONCAT(',', user_rank, ',') LIKE '%" . $user_rank . "%'";
        }
        $res = $this->query($sql);

        if (empty($goods_id)) {
            foreach ($res as $rows) {
                $favourable[$rows['act_id']]['type'] = 'favourable';
            }
        } else {
            $sql = "SELECT cat_id, brand_id FROM " . $this->pre . "goods WHERE goods_id = '$goods_id'";
            $row = $this->row($sql);
            $category_id = $row['cat_id'];
            $brand_id = $row['brand_id'];

            foreach ($res as $rows) {
                if ($rows['act_range'] == FAR_ALL) {
                    $favourable[$rows['act_id']]['act_type'] = $rows['act_type'];
                } elseif ($rows['act_range'] == FAR_CATEGORY) {
                    /* 找出分类id的子分类id */
                    $id_list = array();
                    $raw_id_list = explode(',', $rows['act_range_ext']);
                    foreach ($raw_id_list as $id) {
                        $id_list = array_merge($id_list, array_keys(cat_list($id, 0, false)));
                    }
                    $ids = join(',', array_unique($id_list));
                    if (strpos(',' . $ids . ',', ',' . $category_id . ',') !== false) {
                        $favourable[$rows['act_id']]['act_type'] = $rows['act_type'];
                    }
                } elseif ($rows['act_range'] == FAR_BRAND) {
                    if (strpos(',' . $rows['act_range_ext'] . ',', ',' . $brand_id . ',') !== false) {
                        $favourable[$rows['act_id']]['act_type'] = $rows['act_type'];
                    }
                } elseif ($rows['act_range'] == FAR_GOODS) {
                    if (strpos(',' . $rows['act_range_ext'] . ',', ',' . $goods_id . ',') !== false) {
                        $favourable[$rows['act_id']]['act_type'] = $rows['act_type'];
                    }
                }
            }
        }
        $sort_time = array();
        $arr = array_merge($group, $package, $favourable);
        foreach ($arr as $key => $value) {
            $sort_time[] = $value['sort'];
        }
        array_multisort($sort_time, SORT_NUMERIC, SORT_DESC, $arr);

        return array_unique($arr);
    }
コード例 #11
0
ファイル: function.php プロジェクト: m7720647/demo
function assign_template($ctype = '', $catlist = array())
{
    ECTouch::view()->assign('image_width', C('image_width'));
    ECTouch::view()->assign('image_height', C('image_height'));
    ECTouch::view()->assign('points_name', C('integral_name'));
    ECTouch::view()->assign('qq', explode(',', C('qq')));
    ECTouch::view()->assign('ww', explode(',', C('ww')));
    ECTouch::view()->assign('ym', explode(',', C('ym')));
    ECTouch::view()->assign('msn', explode(',', C('msn')));
    ECTouch::view()->assign('skype', explode(',', C('skype')));
    ECTouch::view()->assign('stats_code', C('stats_code'));
    ECTouch::view()->assign('copyright', sprintf(L('copyright'), date('Y'), C('shop_name')));
    ECTouch::view()->assign('shop_name', C('shop_name'));
    ECTouch::view()->assign('service_email', C('service_email'));
    ECTouch::view()->assign('service_phone', C('service_phone'));
    ECTouch::view()->assign('shop_address', C('shop_address'));
    ECTouch::view()->assign('licensed', license_info());
    ECTouch::view()->assign('ecs_version', VERSION);
    ECTouch::view()->assign('icp_number', C('icp_number'));
    ECTouch::view()->assign('username', !empty($_SESSION['user_name']) ? $_SESSION['user_name'] : '');
    ECTouch::view()->assign('category_list', cat_list(0, 0, true, 2, false));
    ECTouch::view()->assign('catalog_list', cat_list(0, 0, false, 1, false));
    ECTouch::view()->assign('navigator_list', model('Common')->get_navigator($ctype, $catlist));
    //自定义导航栏
    $search_keywords = C('search_keywords');
    if (!empty($search_keywords)) {
        $searchkeywords = explode(',', trim(C('search_keywords')));
    } else {
        $searchkeywords = array();
    }
    ECTouch::view()->assign('searchkeywords', $searchkeywords);
}
コード例 #12
0
function assign_template($ctype = '', $catlist = array())
{
    global $smarty, $db;
    $smarty->assign('image_width', $GLOBALS['_CFG']['image_width']);
    $smarty->assign('image_height', $GLOBALS['_CFG']['image_height']);
    $smarty->assign('points_name', $GLOBALS['_CFG']['integral_name']);
    $smarty->assign('qq', explode(',', $GLOBALS['_CFG']['qq']));
    $smarty->assign('ww', explode(',', $GLOBALS['_CFG']['ww']));
    $smarty->assign('ym', explode(',', $GLOBALS['_CFG']['ym']));
    $smarty->assign('msn', explode(',', $GLOBALS['_CFG']['msn']));
    $smarty->assign('skype', explode(',', $GLOBALS['_CFG']['skype']));
    $smarty->assign('stats_code', $GLOBALS['_CFG']['stats_code']);
    $smarty->assign('copyright', sprintf($GLOBALS['_LANG']['copyright'], date('Y'), $GLOBALS['_CFG']['shop_name']));
    $smarty->assign('shop_name', $GLOBALS['_CFG']['shop_name']);
    $full_uri = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
    //by Bragg
    $smarty->assign('shop_url', substr($full_uri, 0, strripos($full_uri, "mobile/")));
    //by Bragg
    $smarty->assign('service_email', $GLOBALS['_CFG']['service_email']);
    $smarty->assign('service_phone', $GLOBALS['_CFG']['service_phone']);
    $smarty->assign('shop_address', $GLOBALS['_CFG']['shop_address']);
    $smarty->assign('licensed', license_info());
    $smarty->assign('ecs_version', VERSION);
    $smarty->assign('icp_number', $GLOBALS['_CFG']['icp_number']);
    $smarty->assign('username', !empty($_SESSION['user_name']) ? $_SESSION['user_name'] : '');
    $smarty->assign('category_list', cat_list(0, 0, true, 2, false));
    $smarty->assign('catalog_list', cat_list(0, 0, false, 1, false));
    $smarty->assign('navigator_list', get_navigator($ctype, $catlist));
    //自定义导航栏
    //查询地区 by wang
    $GLOBALS['_CFG']['shop_country'] = !empty($GLOBALS['_CFG']['shop_country']) ? $GLOBALS['_CFG']['shop_country'] : '0';
    $GLOBALS['_CFG']['shop_province'] = !empty($GLOBALS['_CFG']['shop_province']) ? $GLOBALS['_CFG']['shop_province'] : '0';
    $GLOBALS['_CFG']['shop_city'] = !empty($GLOBALS['_CFG']['shop_city']) ? $GLOBALS['_CFG']['shop_city'] : '0';
    $condition_arr = array($GLOBALS['_CFG']['shop_country'], $GLOBALS['_CFG']['shop_province'], $GLOBALS['_CFG']['shop_city']);
    $condition_str = implode(',', $condition_arr);
    $sql = "select region_name from " . $GLOBALS['ecs']->table('region') . " where region_id in ({$condition_str})";
    $region_arr = $GLOBALS['db']->getAll($sql);
    $shop_region = '';
    if (is_array($region_arr)) {
        foreach ($region_arr as $value) {
            $shop_region .= $value['region_name'];
        }
    }
    $smarty->assign('shop_region', $shop_region);
    //查询地区 by wang
    if (!empty($GLOBALS['_CFG']['search_keywords'])) {
        $searchkeywords = explode(',', trim($GLOBALS['_CFG']['search_keywords']));
    } else {
        $searchkeywords = array();
    }
    $smarty->assign('searchkeywords', $searchkeywords);
}
コード例 #13
0
ファイル: lib_api.php プロジェクト: Ryan007/mybb
function API_EditCategory($post)
{
    /* 加载后台主操作函数 */
    require_once ROOT_PATH . ADMIN_PATH . '/includes/lib_main.php';
    /* 初始化变量 */
    $cat_id = !empty($_POST['cat_id']) ? intval($_POST['cat_id']) : 0;
    $cat['parent_id'] = !empty($_POST['parent_id']) ? intval($_POST['parent_id']) : 0;
    $cat['sort_order'] = !empty($_POST['sort_order']) ? intval($_POST['sort_order']) : 0;
    $cat['keywords'] = !empty($_POST['keywords']) ? trim($_POST['keywords']) : '';
    $cat['cat_desc'] = !empty($_POST['cat_desc']) ? $_POST['cat_desc'] : '';
    $cat['measure_unit'] = !empty($_POST['measure_unit']) ? trim($_POST['measure_unit']) : '';
    $cat['cat_name'] = !empty($_POST['cat_name']) ? trim($_POST['cat_name']) : '';
    $cat['is_show'] = !empty($_POST['is_show']) ? intval($_POST['is_show']) : 0;
    $cat['show_in_nav'] = !empty($_POST['show_in_nav']) ? intval($_POST['show_in_nav']) : 0;
    $cat['style'] = !empty($_POST['style']) ? trim($_POST['style']) : '';
    $cat['grade'] = !empty($_POST['grade']) ? intval($_POST['grade']) : 0;
    $cat['filter_attr'] = !empty($_POST['filter_attr']) ? intval($_POST['filter_attr']) : 0;
    /* 判断上级目录是否合法 */
    $children = array_keys(cat_list($cat_id, 0, false));
    // 获得当前分类的所有下级分类
    if (in_array($cat['parent_id'], $children)) {
        /* 选定的父类是当前分类或当前分类的下级分类 */
        client_show_message(401);
    }
    if ($cat['grade'] > 10 || $cat['grade'] < 0) {
        /* 价格区间数超过范围 */
        client_show_message(402);
    }
    if (cat_exists($cat['cat_name'], $cat['parent_id'], $cat_id)) {
        /* 同级别下不能有重复的分类名称 */
        client_show_message(403);
    }
    $dat = $GLOBALS['db']->getRow("SELECT cat_name, show_in_nav FROM " . $GLOBALS['ecs']->table('category') . " WHERE cat_id = '{$cat_id}'");
    if ($GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('category'), $cat, 'UPDATE', "cat_id='{$cat_id}'")) {
        if ($cat['cat_name'] != $dat['cat_name']) {
            //如果分类名称发生了改变
            $sql = "UPDATE " . $GLOBALS['ecs']->table('nav') . " SET name = '" . $cat['cat_name'] . "' WHERE ctype = 'c' AND cid = '" . $cat_id . "' AND type = 'middle'";
            $GLOBALS['db']->query($sql);
        }
        if ($cat['show_in_nav'] != $dat['show_in_nav']) {
            //是否显示于导航栏发生了变化
            if ($cat['show_in_nav'] == 1) {
                //显示
                $nid = $GLOBALS['db']->getOne("SELECT id FROM " . $GLOBALS['ecs']->table('nav') . " WHERE ctype = 'c' AND cid = '" . $cat_id . "' AND type = 'middle'");
                if (empty($nid)) {
                    //不存在
                    $vieworder = $GLOBALS['db']->getOne("SELECT max(vieworder) FROM " . $GLOBALS['ecs']->table('nav') . " WHERE type = 'middle'");
                    $vieworder += 2;
                    $uri = build_uri('category', array('cid' => $cat_id), $cat['cat_name']);
                    $sql = "INSERT INTO " . $GLOBALS['ecs']->table('nav') . " (name,ctype,cid,ifshow,vieworder,opennew,url,type) VALUES('" . $cat['cat_name'] . "', 'c', '{$cat_id}','1','{$vieworder}','0', '" . $uri . "','middle')";
                } else {
                    $sql = "UPDATE " . $GLOBALS['ecs']->table('nav') . " SET ifshow = 1 WHERE ctype = 'c' AND cid = '" . $cat_id . "' AND type = 'middle'";
                }
                $GLOBALS['db']->query($sql);
            } else {
                //去除
                $GLOBALS['db']->query("UPDATE " . $GLOBALS['ecs']->table('nav') . " SET ifshow = 0 WHERE ctype = 'c' AND cid = '" . $cat_id . "' AND type = 'middle'");
            }
        }
    }
    /* 更新分類信息成功 */
    clear_cache_files();
    // 清除缓存
    admin_log($_POST['cat_name'], 'edit', 'category');
    // 记录管理员操作
    client_show_message(0, true);
}
コード例 #14
0
ファイル: flow.php プロジェクト: moonlight-wang/feilun
/**
 * 取得购物车中某优惠活动范围内的总金额
 * @param   array   $favourable     优惠活动
 * @return  float
 */
function cart_favourable_amount($favourable)
{
    $sql_where = $_SESSION['user_id'] > 0 ? "c.user_id='" . $_SESSION['user_id'] . "' " : "c.session_id = '" . SESS_ID . "' AND c.user_id=0 ";
    //添加 www.68ecshop.com
    /* 查询优惠范围内商品总额的sql */
    /* 代码修改_start  By  www.68ecshop.com  将这块替换掉*/
    $sql = "SELECT SUM(c.goods_price * c.goods_number) " . "FROM " . $GLOBALS['ecs']->table('cart') . " AS c, " . $GLOBALS['ecs']->table('goods') . " AS g " . "WHERE c.goods_id = g.goods_id " . "AND {$sql_where} " . "AND c.rec_type = '" . CART_GENERAL_GOODS . "' " . "AND g.supplier_id=" . $favourable['supplier_id'] . " " . "AND c.is_gift = 0 " . "AND c.goods_id > 0 ";
    /* 代码修改_end  By  www.68ecshop.com  */
    /* 根据优惠范围修正sql */
    if ($favourable['act_range'] == FAR_ALL) {
        // sql do not change
    } elseif ($favourable['act_range'] == FAR_CATEGORY) {
        /* 取得优惠范围分类的所有下级分类 */
        $id_list = array();
        $cat_list = explode(',', $favourable['act_range_ext']);
        foreach ($cat_list as $id) {
            $id_list = array_merge($id_list, array_keys(cat_list(intval($id), 0, false)));
        }
        $sql .= "AND g.cat_id " . db_create_in($id_list);
    } elseif ($favourable['act_range'] == FAR_BRAND) {
        $id_list = explode(',', $favourable['act_range_ext']);
        $sql .= "AND g.brand_id " . db_create_in($id_list);
    } else {
        $id_list = explode(',', $favourable['act_range_ext']);
        $sql .= "AND g.goods_id " . db_create_in($id_list);
    }
    $sql .= isset($_REQUEST['sel_goods']) && !empty($_REQUEST['sel_goods']) ? " AND c.rec_id in (" . $_REQUEST['sel_goods'] . ") " : "";
    //计算某个店铺的商品总额
    if (isset($_REQUEST['suppid'])) {
        $sql .= " AND g.supplier_id=" . intval($_REQUEST['suppid']);
    }
    //echo $sql;
    /* 优惠范围内的商品总额 */
    return $GLOBALS['db']->getOne($sql);
}
コード例 #15
0
ファイル: goods.php プロジェクト: dlpc/ecshop
function agency_goods_list()
{
    /* 过滤查询 */
    $code = empty($_REQUEST['extension_code']) ? '' : trim($_REQUEST['extension_code']);
    $code = $code == 'virtual_card' ? 'virtual_card' : '';
    $cat_id = isset($_POST['cat_id']) ? intval($_POST['cat_id']) : 0;
    $brand_id = isset($_POST['brand_id']) ? intval($_POST['brand_id']) : 0;
    $keyword = isset($_POST['keyword']) ? trim($_POST['keyword']) : '';
    $GLOBALS['smarty']->assign('action_link', list_link($is_add, $code));
    $GLOBALS['smarty']->assign('cat_list', cat_list(0, $cat_id));
    $GLOBALS['smarty']->assign('brand_list', get_brand_list());
    $GLOBALS['smarty']->assign('search_keyword', $keyword);
    $GLOBALS['smarty']->assign('brand_id', $brand_id);
    $filter = array();
    $filter['cat_id'] = $cat_id;
    $filter['brand_id'] = $brand_id;
    $filter['keyword'] = $keyword;
    $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'goods_id' : trim($_REQUEST['sort_by']);
    $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']);
    $where = ' WHERE is_delete = 0 and admin_agency_id = 0 ';
    if ($code) {
        $where .= " AND is_real = 0 ";
    } else {
        $where .= " AND is_real = 1 ";
    }
    if ($cat_id > 0) {
        $where .= " AND cat_id = '{$cat_id}' ";
    }
    if ($brand_id > 0) {
        $where .= " AND brand_id = '{$brand_id}' ";
    }
    if ($keyword) {
        $where .= ' AND goods_name like \'%' . mysql_real_escape_string($keyword) . '%\'' . ' OR goods_sn like \'%' . $keyword . '%\'';
    }
    $admin_agency_id = admin_agency_id();
    if ($admin_agency_id) {
        $where .= " AND (SELECT goods_id FROM " . $GLOBALS['ecs']->table('goods_supplier') . " WHERE admin_agency_id = {$admin_agency_id} and host_goods_id = g.goods_id limit 1) is null";
    }
    /* 获得总记录数据 */
    $sql = 'SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('goods_supplier') . ' as g' . $where;
    $filter['record_count'] = $GLOBALS['db']->getOne($sql);
    $filter = page_and_size($filter);
    /* 获得商品数据 */
    $arr = array();
    $sql = 'SELECT goods_id,goods_name,goods_sn,shop_price,costing_price' . ' FROM ' . $GLOBALS['ecs']->table('goods_supplier') . ' as g ' . $where . ' ORDER BY goods_id desc ';
    $res = $GLOBALS['db']->selectLimit($sql, $filter['page_size'], $filter['start']);
    while ($rows = $GLOBALS['db']->fetchRow($res)) {
        $arr[] = $rows;
    }
    //是否已添加
    foreach ($arr as $good_k => $good_v) {
        $goods_id_arr[] = $good_v['goods_id'];
        $goods_price_arr[] = $good_v['shop_price'];
    }
    $filter['goods_id_arr'] = json_encode($goods_id_arr);
    $filter['goods_price_arr'] = json_encode($goods_price_arr);
    //dump($arr);
    return array('goods_res' => $arr, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']);
}
コード例 #16
0
ファイル: catalog.php プロジェクト: moonlight-wang/feilun
 * 网站地址: http://www.68ecshop.com;
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
 * 使用;不允许对程序代码以任何形式任何目的的再发布。
 * ============================================================================
 * $Author: derek $
 * $Id: catalog.php 17217 2011-01-19 06:29:08Z derek $
*/
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);
コード例 #17
0
function get_sysnav()
{
    global $_LANG;
    $sysmain = array(array($_LANG['view_cart'], 'flow.php'), array($_LANG['pick_out'], 'pick_out.php'), array($_LANG['group_buy_goods'], 'group_buy.php'), array($_LANG['snatch'], 'snatch.php'), array($_LANG['tag_cloud'], 'tag_cloud.php'), array($_LANG['user_center'], 'user.php'), array($_LANG['wholesale'], 'wholesale.php'), array($_LANG['activity'], 'activity.php'), array($_LANG['myship'], 'myship.php'), array($_LANG['message_board'], 'message.php'), array($_LANG['quotation'], 'quotation.php'));
    $sysmain[] = array('-', '-');
    $catlist = array_merge(cat_list(0, 0, false), array('-'), article_cat_list(0, 0, false));
    foreach ($catlist as $key => $val) {
        $val['view_name'] = $val['cat_name'];
        for ($i = 0; $i < $val['level']; $i++) {
            $val['view_name'] = '&nbsp;&nbsp;&nbsp;&nbsp;' . $val['view_name'];
        }
        $val['url'] = str_replace('&amp;', '&', $val['url']);
        $val['url'] = str_replace('&', '&amp;', $val['url']);
        $sysmain[] = array($val['cat_name'], $val['url'], $val['view_name']);
    }
    return $sysmain;
}
コード例 #18
0
ファイル: message.php プロジェクト: jinjing1989/wei
    }
}
if ($action == 'default') {
    assign_template();
    $position = assign_ur_here(0, $_LANG['message_board']);
    $smarty->assign('page_title', $position['title']);
    // 页面标题
    $smarty->assign('ur_here', $position['ur_here']);
    // 当前位置
    $smarty->assign('helps', get_shop_help());
    // 网店帮助
    $smarty->assign('categories', get_categories_tree());
    // 分类树
    $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);
コード例 #19
0
ファイル: suppliers_goods.php プロジェクト: netroby/ecshop
             $gallery_img[$key]['thumb_url'] = '../' . (empty($gallery_img['thumb_url']) ? $gallery_img['img_url'] : $gallery_img['thumb_url']);
         }
     }
 }
 /* 拆分商品名称样式 */
 $goods_name_style = explode('+', empty($goods['goods_name_style']) ? '+' : $goods['goods_name_style']);
 /* 创建 html editor */
 create_html_editor('goods_desc', $goods['goods_desc']);
 /* 模板赋值 */
 $smarty->assign('code', $code);
 $smarty->assign('ur_here', $is_add ? empty($code) ? $_LANG['02_goods_add'] : $_LANG['51_virtual_card_add'] : ($_REQUEST['act'] == 'edit' ? $_LANG['edit_goods'] : $_LANG['copy_goods']));
 $smarty->assign('action_link', list_link($is_add, $code));
 $smarty->assign('goods', $goods);
 $smarty->assign('goods_name_color', $goods_name_style[0]);
 $smarty->assign('goods_name_style', $goods_name_style[1]);
 $smarty->assign('cat_list', cat_list(0, $goods['cat_id']));
 $smarty->assign('brand_list', get_brand_list());
 $smarty->assign('unit_list', get_unit_list());
 $smarty->assign('user_rank_list', get_user_rank_list());
 $smarty->assign('weight_unit', $is_add ? '1' : ($goods['goods_weight'] >= 1 ? '1' : '0.001'));
 $smarty->assign('cfg', $_CFG);
 $smarty->assign('form_act', $is_add ? 'insert' : ($_REQUEST['act'] == 'edit' ? 'update' : 'insert'));
 if ($_REQUEST['act'] == 'add' || $_REQUEST['act'] == 'edit') {
     $smarty->assign('is_add', true);
 }
 if (!$is_add) {
     $smarty->assign('member_price_list', get_member_price_list($_REQUEST['goods_id']));
 }
 $smarty->assign('link_goods_list', $link_goods_list);
 $smarty->assign('group_goods_list', $group_goods_list);
 $smarty->assign('goods_article_list', $goods_article_list);
コード例 #20
0
ファイル: lib_main.php プロジェクト: noikiy/mdwp
function assign_template($ctype = '', $catlist = array())
{
    global $smarty;

    $smarty->assign('image_width',   $GLOBALS['_CFG']['image_width']);
    $smarty->assign('image_height',  $GLOBALS['_CFG']['image_height']);
    $smarty->assign('points_name',   $GLOBALS['_CFG']['integral_name']);
    $smarty->assign('qq',            explode(',', $GLOBALS['_CFG']['qq']));
    $smarty->assign('ww',            explode(',', $GLOBALS['_CFG']['ww']));
    $smarty->assign('ym',            explode(',', $GLOBALS['_CFG']['ym']));
    $smarty->assign('msn',           explode(',', $GLOBALS['_CFG']['msn']));
    $smarty->assign('skype',         explode(',', $GLOBALS['_CFG']['skype']));
    $smarty->assign('stats_code',    $GLOBALS['_CFG']['stats_code']);
    $smarty->assign('copyright',     sprintf($GLOBALS['_LANG']['copyright'], date('Y'), $GLOBALS['_CFG']['shop_name']));
    $smarty->assign('shop_name',     $GLOBALS['_CFG']['shop_name']);
    $smarty->assign('service_email', $GLOBALS['_CFG']['service_email']);
    $smarty->assign('service_phone', $GLOBALS['_CFG']['service_phone']);
    $smarty->assign('shop_address',  $GLOBALS['_CFG']['shop_address']);
    $smarty->assign('licensed',      license_info());
    $smarty->assign('ecs_version',   VERSION);
    $smarty->assign('icp_number',    $GLOBALS['_CFG']['icp_number']);
    $smarty->assign('username',      !empty($_SESSION['user_name']) ? $_SESSION['user_name'] : '');
    $smarty->assign('category_list', cat_list(0, 0, true,  2, false));
    $smarty->assign('catalog_list',  cat_list(0, 0, false, 1, false));
    $smarty->assign('navigator_list',        get_navigator($ctype, $catlist));  //自定义导航栏

    if (!empty($GLOBALS['_CFG']['search_keywords']))
    {
        $searchkeywords = explode(',', trim($GLOBALS['_CFG']['search_keywords']));
    }
    else
    {
        $searchkeywords = array();
    }
    $smarty->assign('searchkeywords', $searchkeywords);
}
コード例 #21
0
ファイル: goods.php プロジェクト: dlpc/ecshop
     // 图片不变
     // 商品属性
     $sql = "DELETE FROM " . $ecs->table('goods_attr') . " WHERE goods_id = 0";
     $db->query($sql);
     $sql = "SELECT 0 AS goods_id, attr_id, attr_value, attr_price " . "FROM " . $ecs->table('goods_attr') . " WHERE goods_id = '{$_REQUEST['goods_id']}' ";
     $res = $db->query($sql);
     while ($row = $db->fetchRow($res)) {
         $db->autoExecute($ecs->table('goods_attr'), addslashes_deep($row), 'INSERT');
     }
 }
 // 扩展分类
 $other_cat_list = array();
 $sql = "SELECT cat_id FROM " . $ecs->table('goods_cat') . " WHERE goods_id = '{$_REQUEST['goods_id']}'";
 $goods['other_cat'] = $db->getCol($sql);
 foreach ($goods['other_cat'] as $cat_id) {
     $other_cat_list[$cat_id] = cat_list(0, $cat_id);
 }
 $smarty->assign('other_cat_list', $other_cat_list);
 $link_goods_list = get_linked_goods($goods['goods_id']);
 // 关联商品
 $group_goods_list = get_group_goods($goods['goods_id']);
 // 配件
 $goods_article_list = get_goods_articles($goods['goods_id']);
 // 关联文章
 if (is_array($group_goods_list)) {
     //by mike add
     foreach ($group_goods_list as $k => $val) {
         $group_goods_list[$k]['goods_name'] = '[套餐' . $val['group_id'] . ']' . $val['goods_name'];
     }
 }
 /* 商品图片路径 */
コード例 #22
0
ファイル: category.php プロジェクト: seanguo166/yinoos
         /* 判断价格区间是否被选中 */
         if (isset($_REQUEST['price_min']) && $price_grade[$temp_key]['start'] == $price_min && $price_grade[$temp_key]['end'] == $price_max) {
             $price_grade[$temp_key]['selected'] = 1;
         } else {
             $price_grade[$temp_key]['selected'] = 0;
         }
     }
     $price_grade[0]['start'] = 0;
     $price_grade[0]['end'] = 0;
     $price_grade[0]['price_range'] = $_LANG['all_attribute'];
     $price_grade[0]['url'] = build_uri('category', array('cid' => $cat_id, 'bid' => $brand, 'price_min' => 0, 'price_max' => 0, 'filter_attr' => $filter_attr_str, 'filter' => $filter), $cat['cat_name']);
     $price_grade[0]['selected'] = empty($price_max) ? 1 : 0;
     $smarty->assign('price_grade', $price_grade);
 }
 /* 品牌筛选 */
 $sql = "SELECT b.brand_id, b.brand_name, b.brand_logo, COUNT(*) AS goods_num " . "FROM " . $GLOBALS['ecs']->table('brand') . "AS b, " . $GLOBALS['ecs']->table('goods') . " AS g LEFT JOIN " . $GLOBALS['ecs']->table('goods_cat') . " AS gc ON g.goods_id = gc.goods_id " . "WHERE g.brand_id = b.brand_id AND ({$children} OR " . 'gc.cat_id ' . db_create_in(array_unique(array_merge(array($cat_id), array_keys(cat_list($cat_id, 0, false))))) . ") AND b.is_show = 1 " . " AND g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 " . "GROUP BY b.brand_id HAVING goods_num > 0 ORDER BY b.sort_order, b.brand_id ASC";
 //此SQL语句增加字段 b.brand_logo,  By  www.68ecshop.com
 $brands = $GLOBALS['db']->getAll($sql);
 //商品来源过滤
 $attr_url_value = array('cid' => $cat_id, 'bid' => $brand, 'price_min' => $price_min, 'price_max' => $price_max, 'filter_attr' => $filter_attr_str);
 $brand_have_logo = 0;
 //代码增加   By    www.68ecshop.com
 foreach ($brands as $key => $val) {
     $temp_key = $key + 1;
     $brands[$temp_key]['brand_name'] = $val['brand_name'];
     $brands[$temp_key]['url'] = build_uri('category', array('cid' => $cat_id, 'bid' => $val['brand_id'], 'price_min' => $price_min, 'price_max' => $price_max, 'filter_attr' => $filter_attr_str, 'filter' => $filter), $cat['cat_name']);
     $brands[$temp_key]['brand_id_68ecshop'] = $val['brand_id'];
     $brands[$temp_key]['brand_logo'] = $val['brand_logo'];
     if ($val['brand_logo']) {
         $brand_have_logo = 1;
     }
コード例 #23
0
 /**
  * 编辑专题
  */
 public function edit()
 {
     $id = I('id');
     if (!$id) {
         $this->redirect(url('index'));
     }
     if (IS_POST) {
         $data = I('data');
         /* 数据验证 */
         $msg = Check::rule(array(array(Check::must($_POST['topic_name']), L('topic_name_empty')), array(Check::must($_POST['start_time']), L('start_time_empty')), array(Check::must($_POST['end_time']), L('end_time_empty'))));
         /* 提示信息 */
         if ($msg !== true) {
             $this->message($msg, NULL, 'error');
         }
         $topic_type = empty($data['topic_type']) ? 0 : intval($data['topic_type']);
         switch ($topic_type) {
             case '0':
             case '1':
                 // 主图上传
                 if ($_FILES['topic_img']['name'] && $_FILES['topic_img']['size'] > 0) {
                     $result = $this->ectouchUpload('topic_img', 'topic_image');
                     if ($result['error'] > 0) {
                         $this->message($result['message'], NULL, 'error');
                     }
                     /* 生成logo链接 */
                     $topic_img = substr($result['message']['topic_img']['savepath'], 2) . $result['message']['topic_img']['savename'];
                 } else {
                     if (!empty($_POST['url'])) {
                         /* 来自互联网图片 不可以是服务器地址 */
                         if (strstr(I('post.url'), 'http') && !strstr(I('post.url'), $_SERVER['SERVER_NAME'])) {
                             /* 取互联网图片至本地 */
                             $topic_img = get_url_image(I('post.url'));
                         } else {
                             sys_msg(L('web_url_no'));
                         }
                     }
                 }
                 $data['topic_img'] = empty($topic_img) ? I('post.img_url') : $topic_img;
                 $htmls = '';
                 break;
             case '2':
                 $htmls = I('post.content');
                 $data['topic_img'] = '';
                 break;
         }
         // 标题图上传
         if ($_FILES['title_pic']['name'] && $_FILES['title_pic']['size'] > 0) {
             $result = $this->ectouchUpload('title_pic', 'topic_image');
             if ($result['error'] > 0) {
                 $this->message($result['message'], NULL, 'error');
             }
             /* 生成logo链接 */
             $data['title_pic'] = substr($result['message']['title_pic']['savepath'], 2) . $result['message']['title_pic']['savename'];
         } else {
             if (!empty($_REQUEST['title_url'])) {
                 /* 来自互联网图片 不可以是服务器地址 */
                 if (strstr(I('post.title_url'), 'http') && !strstr(I('post.title_url'), $_SERVER['SERVER_NAME'])) {
                     /* 取互联网图片至本地 */
                     $data['title_pic'] = get_url_image(I('post.title_url'));
                 } else {
                     sys_msg(L('web_url_no'));
                 }
             }
         }
         unset($target);
         $data['title'] = I('post.topic_name');
         $title_pic = empty($data['title_pic']) ? I('post.title_img_url') : $data['title_pic'];
         $data['template'] = I('post.topic_template_file') ? I('post.topic_template_file') : '';
         $data['start_time'] = local_strtotime(I('post.start_time'));
         $data['end_time'] = local_strtotime(I('post.end_time'));
         $json = new EcsJson();
         $tmp_data = $json->decode($_POST['topic_data']);
         $data['data'] = serialize($tmp_data);
         $data['intro'] = I('post.topic_intro');
         $this->model->table('touch_topic')->data($data)->where('topic_id =' . $id)->update();
         $this->message(L('succed'), url('index'));
     }
     /* 模板赋值 */
     $topic = $this->model->table('touch_topic')->field('*')->where('topic_id =' . $id)->find();
     $topic['start_time'] = local_date('Y-m-d', $topic['start_time']);
     $topic['end_time'] = local_date('Y-m-d', $topic['end_time']);
     $topic['topic_intro'] = html_out($topic['intro']);
     $topic['intro'] = html_out($topic['intro']);
     $json = new EcsJson();
     if ($topic['data']) {
         $topic['data'] = addcslashes($topic['data'], "'");
         $topic['data'] = $json->encode(@unserialize($topic['data']));
         $topic['data'] = addcslashes($topic['data'], "'");
     }
     if (empty($topic['topic_img']) && empty($topic['htmls'])) {
         $topic['topic_type'] = 0;
     } elseif ($topic['htmls'] != '') {
         $topic['topic_type'] = 2;
     } elseif (preg_match('/.swf$/i', $topic['topic_img'])) {
         $topic['topic_type'] = 1;
     } else {
         $topic['topic_type'] = '';
     }
     $this->assign('topic', $topic);
     $this->assign('cat_list', cat_list(0, 1));
     $this->assign('brand_list', model('BrandBase')->get_brand_list());
     $this->assign('template_list', $this->get_topic_temp_list());
     $this->assign('ur_here', L('09_topic'));
     $this->display();
 }
コード例 #24
0
ファイル: search.php プロジェクト: a494008974/bzbshop
             if ($val['type'] == 2) {
                 $attributes['attr'][$key]['value']['from'] = !empty($_REQUEST['attr'][$val['id']]['from']) ? trim($_REQUEST['attr'][$val['id']]['from']) : '';
                 $attributes['attr'][$key]['value']['to'] = !empty($_REQUEST['attr'][$val['id']]['to']) ? trim($_REQUEST['attr'][$val['id']]['to']) : '';
             } else {
                 $attributes['attr'][$key]['value'] = !empty($_REQUEST['attr'][$val['id']]) ? trim($_REQUEST['attr'][$val['id']]) : '';
             }
         }
     }
     if ($_REQUEST['sc_ds']) {
         $smarty->assign('scck', 'checked');
     }
     $smarty->assign('adv_val', $adv_value);
     $smarty->assign('goods_type_list', $attributes['cate']);
     $smarty->assign('goods_attributes', $attributes['attr']);
     $smarty->assign('goods_type_selected', $_REQUEST['goods_type']);
     $smarty->assign('cat_list', cat_list(0, $adv_value['category'], true, 2, false));
     $smarty->assign('brand_list', get_brand_list());
     $smarty->assign('action', 'form');
     $smarty->assign('use_storage', $_CFG['use_storage']);
     $action = 'form';
 }
 /* 初始化搜索条件 */
 $keywords = '';
 $tag_where = '';
 if (!empty($_REQUEST['keywords'])) {
     $arr = array();
     if (stristr($_REQUEST['keywords'], ' AND ') !== false) {
         /* 检查关键字中是否有AND,如果存在就是并 */
         $arr = explode('AND', $_REQUEST['keywords']);
         $operator = " AND ";
     } elseif (stristr($_REQUEST['keywords'], ' OR ') !== false) {
コード例 #25
0
ファイル: article.php プロジェクト: norain2050/mhFault
    // 清除相关的缓存文件
    sys_msg($_LANG['articleadd_succeed'], 0, $link);
}
/*------------------------------------------------------ */
//-- 编辑
/*------------------------------------------------------ */
if ($_REQUEST['act'] == 'edit') {
    /* 权限判断 */
    admin_priv('article_manage');
    /* 取文章数据 */
    $sql = "SELECT * FROM " . $ecs->table('article') . " WHERE article_id='{$_REQUEST['id']}'";
    $article = $db->GetRow($sql);
    /* 创建 html editor */
    create_html_editor('FCKeditor1', $article['content']);
    /* 取得分类、品牌 */
    $smarty->assign('goods_cat_list', cat_list());
    $smarty->assign('brand_list', get_brand_list());
    /* 取得关联商品 */
    $goods_list = get_article_goods($_REQUEST['id']);
    $smarty->assign('goods_list', $goods_list);
    $smarty->assign('article', $article);
    $smarty->assign('cat_select', article_cat_list(0, $article['cat_id']));
    $smarty->assign('ur_here', $_LANG['article_edit']);
    $smarty->assign('action_link', array('text' => $_LANG['03_article_list'], 'href' => 'article.php?act=list&' . list_link_postfix()));
    $smarty->assign('form_action', 'update');
    assign_query_info();
    $smarty->display('article_info.htm');
}
if ($_REQUEST['act'] == 'update') {
    /* 权限判断 */
    admin_priv('article_manage');
コード例 #26
0
ファイル: flow.php プロジェクト: will0306/bianli100
/**
 * 取得购物车中某优惠活动范围内的总金额
 * @param   array   $favourable     优惠活动
 * @return  float
 */
function cart_favourable_amount($favourable)
{
    /* 查询优惠范围内商品总额的sql */
    $sql = "SELECT SUM(c.goods_price * c.goods_number) " . "FROM " . $GLOBALS['ecs']->table('cart') . " AS c, " . $GLOBALS['ecs']->table('goods') . " AS g " . "WHERE c.goods_id = g.goods_id " . "AND c.session_id = '" . SESS_ID . "' " . "AND c.rec_type = '" . CART_GENERAL_GOODS . "' " . "AND c.is_gift = 0 " . "AND c.goods_id > 0 ";
    /* 根据优惠范围修正sql */
    if ($favourable['act_range'] == FAR_ALL) {
        // sql do not change
    } elseif ($favourable['act_range'] == FAR_CATEGORY) {
        /* 取得优惠范围分类的所有下级分类 */
        $id_list = array();
        $cat_list = explode(',', $favourable['act_range_ext']);
        foreach ($cat_list as $id) {
            $id_list = array_merge($id_list, array_keys(cat_list(intval($id), 0, false)));
        }
        $sql .= "AND g.cat_id " . db_create_in($id_list);
    } elseif ($favourable['act_range'] == FAR_BRAND) {
        $id_list = explode(',', $favourable['act_range_ext']);
        $sql .= "AND g.brand_id " . db_create_in($id_list);
    } else {
        $id_list = explode(',', $favourable['act_range_ext']);
        $sql .= "AND g.goods_id " . db_create_in($id_list);
    }
    /* 优惠范围内的商品总额 */
    return $GLOBALS['db']->getOne($sql);
}
コード例 #27
0
/**
 * 获得指定分类下所有底层分类的ID
 *
 * @access  public
 * @param   integer     $cat        指定的分类ID
 * @return  string
 */
function get_children($cat = 0)
{
    return 'g.cat_id ' . db_create_in(array_unique(array_merge(array($cat), array_keys(cat_list($cat, 0, false)))));
}
コード例 #28
0
ファイル: goods_stock_control.php プロジェクト: dlpc/ecshop
 $suppliers_exists = 1;
 if (empty($suppliers_list_name)) {
     $suppliers_exists = 0;
 }
 $smarty->assign('is_on_sale', $is_on_sale);
 $smarty->assign('suppliers_id', $suppliers_id);
 $smarty->assign('suppliers_exists', $suppliers_exists);
 $smarty->assign('suppliers_list_name', $suppliers_list_name);
 unset($suppliers_list_name, $suppliers_exists);
 /* 模板赋值 */
 $goods_ur = array('' => $_LANG['goods_stock_control'], 'virtual_card' => $_LANG['50_virtual_card_list']);
 $ur_here = $_REQUEST['act'] == 'list' ? $goods_ur[$code] : $_LANG['11_goods_trash'];
 $smarty->assign('ur_here', $ur_here);
 $smarty->assign('action_link', $action_link);
 $smarty->assign('code', $code);
 $smarty->assign('cat_list', cat_list(0, $cat_id));
 $smarty->assign('brand_list', get_brand_list());
 $smarty->assign('intro_list', get_intro_list());
 $smarty->assign('lang', $_LANG);
 $smarty->assign('list_type', $_REQUEST['act'] == 'list' ? 'goods' : 'trash');
 $smarty->assign('use_storage', empty($_CFG['use_storage']) ? 0 : 1);
 $suppliers_list = suppliers_list_info(' is_check = 1 ');
 $suppliers_list_count = count($suppliers_list);
 $smarty->assign('suppliers_list', $suppliers_list_count == 0 ? 0 : $suppliers_list);
 // 取供货商列表
 $goods_list = goods_list($_REQUEST['act'] == 'list' ? 0 : 1, $_REQUEST['act'] == 'list' ? $code == '' ? 1 : 0 : -1);
 //dump($goods_list);
 $smarty->assign('goods_list', $goods_list['goods']);
 $smarty->assign('filter', $goods_list['filter']);
 $smarty->assign('record_count', $goods_list['record_count']);
 $smarty->assign('page_count', $goods_list['page_count']);
コード例 #29
0
ファイル: category.php プロジェクト: GYWang1983/fruit
        /* 提示信息 */
        $link[] = array('text' => $_LANG['back_list'], 'href' => 'category.php?act=list');
        sys_msg($_LANG['catedit_succed'], 0, $link);
    }
}
/*------------------------------------------------------ */
//-- 批量转移商品分类页面
/*------------------------------------------------------ */
if ($_REQUEST['act'] == 'move') {
    /* 权限检查 */
    admin_priv('cat_drop');
    $cat_id = !empty($_REQUEST['cat_id']) ? intval($_REQUEST['cat_id']) : 0;
    /* 模板赋值 */
    $smarty->assign('ur_here', $_LANG['move_goods']);
    $smarty->assign('action_link', array('href' => 'category.php?act=list', 'text' => $_LANG['03_category_list']));
    $smarty->assign('cat_select', cat_list(0, $cat_id, true));
    $smarty->assign('form_act', 'move_cat');
    /* 显示页面 */
    assign_query_info();
    $smarty->display('category_move.htm');
}
/*------------------------------------------------------ */
//-- 处理批量转移商品分类的处理程序
/*------------------------------------------------------ */
if ($_REQUEST['act'] == 'move_cat') {
    /* 权限检查 */
    admin_priv('cat_drop');
    $cat_id = !empty($_POST['cat_id']) ? intval($_POST['cat_id']) : 0;
    $target_cat_id = !empty($_POST['target_cat_id']) ? intval($_POST['target_cat_id']) : 0;
    /* 商品分类不允许为空 */
    if ($cat_id == 0 || $target_cat_id == 0) {
コード例 #30
0
ファイル: template.php プロジェクト: norain2050/mhFault
                $ad_positions[] = array('region' => $val['region'], 'sort_order' => $val['sort_order'], 'number' => $row['number'], 'ad_pos' => $row['id']);
            } else {
                $ad_positions[] = array('region' => $val['region'], 'sort_order' => $val['sort_order'], 'number' => 0, 'ad_pos' => 0);
            }
        }
    }
    assign_query_info();
    $smarty->assign('ur_here', $_LANG['03_template_setup']);
    $smarty->assign('curr_template_file', $curr_template);
    $smarty->assign('temp_options', $temp_options);
    $smarty->assign('temp_regions', $temp_regions);
    $smarty->assign('cate_goods', $cate_goods);
    $smarty->assign('brand_goods', $brand_goods);
    $smarty->assign('cat_articles', $cat_articles);
    $smarty->assign('ad_positions', $ad_positions);
    $smarty->assign('arr_cates', cat_list(0, 0, true));
    $smarty->assign('arr_brands', get_brand_list());
    $smarty->assign('arr_article_cats', article_cat_list(0, 0, true));
    $smarty->assign('arr_ad_positions', get_position_list());
    $smarty->display('template_setup.htm');
}
/*------------------------------------------------------ */
//-- 提交模板内容设置
/*------------------------------------------------------ */
if ($_REQUEST['act'] == 'setting') {
    admin_priv('template_setup');
    $curr_template = $_CFG['template'];
    $db->query("DELETE FROM " . $ecs->table('template') . " WHERE remarks = '' AND filename = '{$_POST['template_file']}' AND theme = '{$curr_template}'");
    /* 先处理固定内容 */
    foreach ($_POST['regions'] as $key => $val) {
        $number = isset($_POST['number'][$key]) ? intval($_POST['number'][$key]) : 0;