Example #1
0
    clear_cache_files();
    make_json_result($opt);
} elseif ($_REQUEST['act'] == 'drop_group_goods') {
    include_once ROOT_PATH . 'includes/cls_json.php';
    $json = new JSON();
    check_authz_json('goods_manage');
    $fittings = $json->decode($_GET['drop_ids']);
    $arguments = $json->decode($_GET['JSON']);
    $goods_id = $arguments[0];
    $price = $arguments[1];
    $sql = "DELETE FROM " . $ecs->table('group_goods') . " WHERE parent_id='{$goods_id}' AND " . db_create_in($fittings, 'goods_id');
    if ($goods_id == 0) {
        $sql .= " AND admin_id = '{$_SESSION['admin_id']}'";
    }
    $db->query($sql);
    $arr = get_group_goods($goods_id);
    $opt = array();
    foreach ($arr as $val) {
        $opt[] = array('value' => $val['goods_id'], 'text' => '[套餐' . $val['group_id'] . ']' . $val['goods_name'], 'data' => '');
    }
    clear_cache_files();
    make_json_result($opt);
} elseif ($_REQUEST['act'] == 'get_article_list') {
    include_once ROOT_PATH . 'includes/cls_json.php';
    $json = new JSON();
    $filters = (array) $json->decode(json_str_iconv($_GET['JSON']));
    $where = " WHERE cat_id > 0 ";
    if (!empty($filters['title'])) {
        $keyword = trim($filters['title']);
        $where .= " AND title LIKE '%" . mysql_like_quote($keyword) . "%' ";
    }
Example #2
0
     $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 (isset($GLOBALS['shop_id']) && $GLOBALS['shop_id'] > 10 && !empty($goods['original_img'])) {
     $goods['goods_img'] = get_image_path($_REQUEST['goods_id'], $goods['goods_img']);
     $goods['goods_thumb'] = get_image_path($_REQUEST['goods_id'], $goods['goods_thumb'], true);
 }
 /* 图片列表 */
 $sql = "SELECT * FROM " . $ecs->table('goods_gallery') . " WHERE goods_id = '{$goods['goods_id']}'";
 $img_list = $db->getAll($sql);
 /* 格式化相册图片路径 */
 if (isset($GLOBALS['shop_id']) && $GLOBALS['shop_id'] > 0) {
     foreach ($img_list as $key => $gallery_img) {
         $gallery_img[$key]['img_url'] = get_image_path($gallery_img['goods_id'], $gallery_img['img_original'], false, 'gallery');