示例#1
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)); // 注释 2015-03-19 代理商跟主站的分类分开
    /*ccx 2015-03-18 代理商显示代理商自己的商品分类 start */
    $GLOBALS['smarty']->assign('cat_list', cat_list_ccx(0, $cat_id));
    /*ccx 2015-03-18 代理商显示代理商自己的商品分类 end */
    $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') . " 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') . ' 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') . ' 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']);
}
示例#2
0
文件: topic.php 项目: netroby/ecshop
    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']);
        create_html_editor('topic_intro', $topic['intro']);
示例#3
0
            } 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;
        if (!in_array($key, $GLOBALS['dyna_libs']) and (isset($_POST['display'][$key]) and $_POST['display'][$key] == 1 or $number > 0)) {
示例#4
0
            $res['error_msg'] = '根据记录,此顾客有风险,请通知上级主管进行排查!';
        }
        $res['code'] = true;
    }
    $res['is_black'] = $is_black;
    die($json->encode($res));
} elseif ($_REQUEST['act'] == 'search_by_goods') {
    if (!admin_priv('search_by_goods', '', false)) {
        $msg = array('req_msg' => true, 'timeout' => 2000, 'message' => '访问未经授权!');
    }
    if (admin_priv('all', '', false)) {
        $smarty->assign('all', true);
        $smarty->assign('role_list', get_role_customer(' AND role_id IN(' . KEFU . ',' . KEFU2 . ',13)'));
    }
    // 品牌列表
    $brand_list = get_brand_list(' WHERE is_show=1 ');
    $smarty->assign('brand_list', $brand_list);
    // 商品列表
    $goods_list = goods_list(0);
    $smarty->assign('goods_list', $goods_list['goods']);
    $smarty->assign('full_page', 1);
    $res['main'] = $smarty->fetch('search_by_goods.htm');
    echo $json->encode($res);
    return;
} elseif ($_REQUEST['act'] == 'list_goods_by_brand') {
    $brand_id = intval($_REQUEST['brand_id']);
    $sql_select = 'SELECT goods_id,goods_name FROM ' . $GLOBALS['ecs']->table('goods') . " WHERE brand_id={$brand_id} AND is_on_sale=1";
    $goods_list = $GLOBALS['db']->getAll($sql_select);
    echo $json->encode($goods_list);
    return;
} elseif ($_REQUEST['act'] == 'show_goods_users') {
示例#5
0
 /* 修改 by www.68ecshop.com 百度编辑器 */
 /* 模板赋值 */
 $smarty->assign('code', $code);
 $smarty->assign('ur_here', $is_add ? empty($code) ? $_LANG['03_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('cat_other_list', cat_list(0));
 $cat_list = cat_list(0, $selected, false);
 $smarty->assign('goods_cat_list', cat_list_to_json($cat_list, $goods['cat_id']));
 $smarty->assign('goods_cat_name', $cat_list[$goods['cat_id']]['cat_name']);
 $smarty->assign('goods_cat_id', $goods['cat_id']);
 // 代码增加_start_derek20150129admin_goods  www.68ecshop.com
 $smarty->assign('brand_list_new', get_brand_list(true));
 // 代码增加_start_derek20150129admin_goods  www.68ecshop.com
 $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);
示例#6
0
/**
 * 编辑预售活动
 */
function action_edit()
{
    $user = $GLOBALS['user'];
    $_CFG = $GLOBALS['_CFG'];
    $_LANG = $GLOBALS['_LANG'];
    $smarty = $GLOBALS['smarty'];
    $db = $GLOBALS['db'];
    $ecs = $GLOBALS['ecs'];
    $user_id = $_SESSION['user_id'];
    $pre_sale_id = intval($_REQUEST['id']);
    if ($pre_sale_id <= 0) {
        die('invalid param');
    }
    $pre_sale = pre_sale_info($pre_sale_id);
    $smarty->assign('pre_sale', $pre_sale);
    /* 模板赋值 */
    $smarty->assign('ur_here', $_LANG['add_pre_sale']);
    $smarty->assign('action_link', list_link($action == 'add'));
    $smarty->assign('cat_list', cat_list());
    $smarty->assign('brand_list', get_brand_list());
    /* 显示模板 */
    assign_query_info();
    $smarty->display('pre_sale_info.htm');
}
示例#7
0
<?php

/*********************/
/*                   */
/*  Version : 5.1.0  */
/*  Author  : RM     */
/*  Comment : 071223 */
/*                   */
/*********************/
$sort = isset($_REQUEST['sort']) && in_array(trim(strtolower($_REQUEST['sort'])), array("goods_id", "shop_price", "sell_number", "comment_count")) ? trim($_REQUEST['sort']) : $default_sort_order_type;
$smarty->assign("cat_list", cat_list(0, 0, TRUE, 2, FALSE));
$smarty->assign("brand_list", get_brand_list());
$sql = "SELECT g.goods_id, g.goods_name,g.goods_sn, g.market_price,g.is_promote, 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, ") . "(select AVG(r.comment_rank) from " . $GLOBALS['ecs']->table("comment") . " as r where r.id_value = g.goods_id AND r.comment_type = 0 AND r.parent_id = 0 AND r.status = 1) AS comment_rank, (select IFNULL(sum(r.id_value), 0) from " . $GLOBALS['ecs']->table("comment") . " as r where r.id_value = g.goods_id AND r.comment_type = 0 AND r.parent_id = 0 AND r.status = 1) AS comment_count, (select IFNULL(sum(og.goods_number), 0) from " . $GLOBALS['ecs']->table("order_goods") . " as og where og.goods_id = g.goods_id) AS sell_number, g.promote_price, g.promote_start_date, g.promote_end_date, g.goods_thumb, g.goods_img, g.goods_brief, g.goods_type FROM " . $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_delete = 0 AND g.is_on_sale = 1 AND g.is_alone_sale = 1 " . $attr_in . " ") . "AND (( 1 " . $categories . $keywords . $brand . $min_price . $max_price . $intro . $outstock . " ) " . $tag_where . " ) " . ("ORDER BY " . $sort . " {$order}");
$res = $db->SelectLimit($sql, $size, ($page - 1) * $size);
$arr = array();
while ($row = $db->FetchRow($res)) {
    if (0 < $row['promote_price']) {
        $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";
    } else {
        if ($row['is_new'] != 0) {
            $watermark_img = "watermark_new_small";
        } else {
            if ($row['is_best'] != 0) {
                $watermark_img = "watermark_best_small";
            } else {