当前位置: 首页>>代码示例>>PHP>>正文


PHP goods_info函数代码示例

本文整理汇总了PHP中goods_info函数的典型用法代码示例。如果您正苦于以下问题:PHP goods_info函数的具体用法?PHP goods_info怎么用?PHP goods_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了goods_info函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: group_buy_info

    /* 查询:取得团购活动信息 */
    $group_buy = group_buy_info($group_buy_id, $number);
    if (empty($group_buy))
    {
        ecs_header("Location: ./\n");
        exit;
    }

    /* 查询:检查团购活动是否是进行中 */
    if ($group_buy['status'] != GBS_UNDER_WAY)
    {
        show_message($_LANG['gb_error_status'], '', '', 'error');
    }

    /* 查询:取得团购商品信息 */
    $goods = goods_info($group_buy['goods_id']);
    if (empty($goods))
    {
        ecs_header("Location: ./\n");
        exit;
    }

    /* 查询:判断数量是否足够 */
    if (($group_buy['restrict_amount'] > 0 && $number > ($group_buy['restrict_amount'] - $group_buy['valid_goods'])) || $number > $goods['goods_number'])
    {
        show_message($_LANG['gb_error_goods_lacking'], '', '', 'error');
    }

    /* 查询:取得规格 */
    $specs = '';
    foreach ($_POST as $key => $value)
开发者ID:blowfishJ,项目名称:galaxyCode,代码行数:31,代码来源:group_buy.php

示例2: action_buy

function action_buy()
{
    $smarty = $GLOBALS['smarty'];
    $db = $GLOBALS['db'];
    $ecs = $GLOBALS['ecs'];
    /* 查询:判断是否登录 */
    if ($_SESSION['user_id'] <= 0) {
        show_message($_LANG['ps_error_login'], '', '', 'error');
    }
    /* 查询:取得参数:预售活动id */
    $pre_sale_id = isset($_POST['pre_sale_id']) ? intval($_POST['pre_sale_id']) : 0;
    if ($pre_sale_id <= 0) {
        ecs_header("Location: pre_sale.php\n");
        exit;
    }
    /* 查询:取得数量 */
    $number = isset($_POST['number']) ? intval($_POST['number']) : 1;
    $number = $number < 1 ? 1 : $number;
    /* 查询:取得预售活动信息 */
    $pre_sale = pre_sale_info($pre_sale_id, $number);
    if (empty($pre_sale)) {
        ecs_header("Location: pre_sale.php\n");
        exit;
    }
    /* 查询:检查预售活动是否是进行中 */
    if ($pre_sale['status'] != PSS_UNDER_WAY) {
        show_message($_LANG['ps_error_status'], '', '', 'error');
    }
    /* 查询:取得预售商品信息 */
    $goods = goods_info($pre_sale['goods_id']);
    if (empty($goods)) {
        ecs_header("Location: pre_sale.php\n");
        exit;
    }
    /* 查询:判断数量是否足够 */
    if ($pre_sale['restrict_amount'] > 0 && $number > $pre_sale['restrict_amount'] - $pre_sale['valid_goods'] || $number > $goods['goods_number']) {
        show_message($_LANG['ps_error_goods_lacking'], '', '', 'error');
    }
    /* 查询:取得规格 */
    $specs = '';
    foreach ($_POST as $key => $value) {
        if (strpos($key, 'spec_') !== false) {
            $specs .= ',' . intval($value);
        }
    }
    $specs = trim($specs, ',');
    /* 查询:如果商品有规格则取规格商品信息 配件除外 */
    if ($specs) {
        $_specs = explode(',', $specs);
        $product_info = get_products_info($goods['goods_id'], $_specs);
    }
    empty($product_info) ? $product_info = array('product_number' => 0, 'product_id' => 0) : '';
    /* 查询:判断指定规格的货品数量是否足够 */
    if ($specs && $number > $product_info['product_number'] && false) {
        show_message($_LANG['ps_error_goods_lacking'], '', '', 'error');
    }
    /* 查询:查询规格名称和值,不考虑价格 */
    $attr_list = array();
    $sql = "SELECT a.attr_name, g.attr_value " . "FROM " . $ecs->table('goods_attr') . " AS g, " . $ecs->table('attribute') . " AS a " . "WHERE g.attr_id = a.attr_id " . "AND g.goods_attr_id " . db_create_in($specs);
    $res = $db->query($sql);
    while ($row = $db->fetchRow($res)) {
        $attr_list[] = $row['attr_name'] . ': ' . $row['attr_value'];
    }
    $goods_attr = join(chr(13) . chr(10), $attr_list);
    /* 更新:清空购物车中所有预售商品 */
    include_once ROOT_PATH . 'includes/lib_order.php';
    clear_cart(CART_pre_sale_GOODS);
    /* 更新:加入购物车 */
    $goods_price = $pre_sale['deposit'] > 0 ? $pre_sale['deposit'] : $pre_sale['cur_price'];
    $cart = array('user_id' => $_SESSION['user_id'], 'session_id' => SESS_ID, 'goods_id' => $pre_sale['goods_id'], 'product_id' => $product_info['product_id'], 'goods_sn' => addslashes($goods['goods_sn']), 'goods_name' => addslashes($goods['goods_name']), 'market_price' => $goods['market_price'], 'goods_price' => $goods_price, 'goods_number' => $number, 'goods_attr' => addslashes($goods_attr), 'goods_attr_id' => $specs, 'is_real' => $goods['is_real'], 'extension_code' => addslashes($goods['extension_code']), 'parent_id' => 0, 'rec_type' => CART_PRE_SALE_GOODS, 'is_gift' => 0);
    $db->autoExecute($ecs->table('cart'), $cart, 'INSERT');
    $_SESSION['sel_cartgoods'] = $db->insert_id();
    $_SESSION['pre_sale_cart'] = $cart;
    /* 更新:记录购物流程类型:预售 */
    $_SESSION['flow_type'] = CART_PRE_SALE_GOODS;
    $_SESSION['extension_code'] = PRE_SALE_CODE;
    $_SESSION['extension_id'] = $pre_sale_id;
    /* 进入收货人页面 */
    ecs_header("Location: ./flow.php?step=checkout\n");
    exit;
}
开发者ID:seanguo166,项目名称:yinoos,代码行数:81,代码来源:pre_sale.php

示例3: show_message

 }
 /* 查询:是否已经有订单 */
 if ($auction['order_count'] > 0) {
     show_message($_LANG['au_order_placed']);
 }
 /* 查询:是否登录 */
 $user_id = $_SESSION['user_id'];
 if ($user_id <= 0) {
     show_message($_LANG['au_buy_after_login']);
 }
 /* 查询:最后出价的是该用户吗 */
 if ($auction['last_bid']['bid_user'] != $user_id) {
     show_message($_LANG['au_final_bid_not_you'], '', '', 'error');
 }
 /* 查询:取得商品信息 */
 $goods = goods_info($auction['goods_id']);
 /* 查询:处理规格属性 */
 $goods_attr = '';
 $goods_attr_id = '';
 if ($auction['product_id'] > 0) {
     $product_info = get_good_products($auction['goods_id'], 'AND product_id = ' . $auction['product_id']);
     $goods_attr_id = str_replace('|', ',', $product_info[0]['goods_attr']);
     $attr_list = array();
     $sql = "SELECT a.attr_name, g.attr_value " . "FROM " . $ecs->table('goods_attr') . " AS g, " . $ecs->table('attribute') . " AS a " . "WHERE g.attr_id = a.attr_id " . "AND g.goods_attr_id " . db_create_in($goods_attr_id);
     $res = $db->query($sql);
     while ($row = $db->fetchRow($res)) {
         $attr_list[] = $row['attr_name'] . ': ' . $row['attr_value'];
     }
     $goods_attr = join(chr(13) . chr(10), $attr_list);
 } else {
     $auction['product_id'] = 0;
开发者ID:xiaoxiaowu007,项目名称:jicai,代码行数:31,代码来源:auction.php

示例4: action_chat

function action_chat()
{
    $user_id = $_SESSION['user_id'];
    $smarty = get_smarty();
    $ecs = get_ecs();
    $db = get_database();
    /**
     * 判断当前用户是为聊天系统的注册用户
     */
    $exist = check_of_username_exist($user_id);
    // 获取用户头像
    if (!empty($user_id)) {
        $sql = "select password, headimg from " . $ecs->table('users') . " where user_id = '{$user_id}'";
        $row = $db->getRow($sql);
        $headimg = $row['headimg'];
        $password = $row['password'];
        $smarty->assign('headimg', $headimg);
    }
    if (!$exist) {
        // 查询ECShop内用户信息
        $sql = 'select a.user_id, a.password, a.email, a.user_name from ' . $ecs->table('users') . ' AS a where a.user_id = "' . $user_id . '"';
        $user = $GLOBALS['db']->getRow($sql);
        if (empty($user)) {
            // 根据user_id未查找到任何用户信息
        }
        // 用户不存在,创建用户信息
        $username = $user_id;
        $password = $user['password'];
        $name = $user['user_name'];
        $email = $user['email'];
        $type = 10;
        $shop_id = -1;
        $result = create_of_user($username, $password, $name, $email, $type, $shop_id);
        if ($result) {
            // 创建成功
        } else {
            // 创建失败
        }
    }
    // 获取前端传来的商品编号、订单编号、店铺编号等
    // 商品编号则显示商品信息
    // 订单编号则显示订单信息
    // 店铺编号则显示店铺信息
    $goods_id = null;
    $supp_id = -1;
    $order_id = null;
    $customers = null;
    // 获取客服信息
    $tab_items = array();
    // 客服类型
    $cus_types = CUSTOMER_SERVICE;
    // 记录需要发给客服的URL
    if (!empty($_REQUEST['chat_goods_id'])) {
        /* 咨询商品信息 */
        $goods_id = $_REQUEST['chat_goods_id'];
        $goods = goods_info($goods_id);
        $smarty->assign('chat_goods', $goods);
        $smarty->assign('chat_goods_id', $goods_id);
        // 获取店铺信息
        $supp_id = null;
        $tab_items[] = array("id" => "chat_goods", "name" => "咨询商品");
        // 客服+售前
        $cus_types = CUSTOMER_SERVICE . ',' . CUSTOMER_PRE;
    }
    if (!empty($_REQUEST['chat_supp_id'])) {
        /* 店铺信息 */
        $supp_id = $_REQUEST['chat_supp_id'];
        $supp_info = get_dianpu_baseinfo($supp_id);
        $smarty->assign('supp_info', $supp_info);
        $smarty->assign('chat_supp_id', $supp_id);
        $tab_items[] = array("id" => "chat_supp", "name" => "店铺信息");
        // 客服+售前
        $cus_types = CUSTOMER_SERVICE . ',' . CUSTOMER_PRE;
    }
    if (!empty($_REQUEST['chat_order_id'])) {
        /* 咨询订单信息 */
        require 'includes/lib_order.php';
        $order_id = $_REQUEST['chat_order_id'];
        // 获取商品和店铺信息
        $goods_id = null;
        $supp_id = null;
        $order = order_info($order_id);
        $order['order_status_text'] = $GLOBALS['_LANG']['os'][$order['order_status']] . ',' . $GLOBALS['_LANG']['ps'][$order['pay_status']] . ',' . $GLOBALS['_LANG']['ss'][$order['shipping_status']];
        $order['goods_list'] = order_goods($order_id);
        $smarty->assign('chat_order', $order);
        $smarty->assign('chat_order_id', $order_id);
        $smarty->assign('chat_order_sn', $order['order_sn']);
        $tab_items[] = array("id" => "chat_order", "name" => "咨询订单");
        // 客服+售后
        $cus_types = CUSTOMER_SERVICE . ',' . CUSTOMER_AFTER;
    }
    if (true) {
        /* 最近订单列表 */
        require 'includes/lib_transaction_1.php';
        // 获取用户最近的5条订单列表
        $order_list = get_user_orders_1($user_id, 5, 0);
        // 所有客服忙碌状态,提示web端
        $smarty->assign('order_list', $order_list);
        $smarty->assign('order_count', count($order_list));
        $tab_items[] = array("id" => "chat_order_list", "name" => "最近订单");
//.........这里部分代码省略.........
开发者ID:seanguo166,项目名称:yinoos,代码行数:101,代码来源:chat.php


注:本文中的goods_info函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。