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


PHP cart_goods函数代码示例

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


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

示例1: flow_available_points

     }
     // 查询用户有多少积分
     $flow_points = flow_available_points();
     // 该订单允许使用的积分
     $user_points = $user_info['pay_points'];
     // 用户的积分总数
     $order['integral'] = min($order['integral'], $user_points, $flow_points);
     if ($order['integral'] < 0) {
         $order['integral'] = 0;
     }
 } else {
     $order['surplus'] = 0;
     $order['integral'] = 0;
 }
 /* 订单中的商品 */
 $cart_goods = cart_goods($flow_type);
 if (empty($cart_goods)) {
     $tips = '您的购物车中没有商品';
 }
 /* 收货人信息 */
 foreach ($consignee as $key => $value) {
     $order[$key] = addslashes($value);
 }
 /* 订单中的总额 */
 $total = order_fee($order, $cart_goods, $consignee);
 $order['bonus'] = $total['bonus'];
 $order['goods_amount'] = $total['goods_price'];
 $order['discount'] = $total['discount'];
 $order['surplus'] = $total['surplus'];
 $order['tax'] = $total['tax'];
 /* 配送方式 */
开发者ID:a494008974,项目名称:bzbshop,代码行数:31,代码来源:order.php

示例2: done

	public function done () {
		global $ecs,$db,$_CFG;
		include_once(RPC_ROOT.'includes/lib_clips_ec.php');
	    include_once(RPC_ROOT.'includes/lib_payment.php');
	
	    /* 取得购物类型 */
	    $flow_type = isset($_SESSION['flow_type']) ? intval($_SESSION['flow_type']) : CART_GENERAL_GOODS;
	
	    /* 检查购物车中是否有商品 */
	    $sql = "SELECT COUNT(*) FROM " . $ecs->table('cart') ." WHERE session_id = '" . SESS_ID . "' " .
	           "AND parent_id = 0 AND is_gift = 0 AND rec_type = '$flow_type'";
	    
		if ($db->getOne($sql) == 0)
	    {
			$msg = rpcLang('flow.php', 'no_goods_in_cart');
			jsonExit("{\"status\":\"$msg\"}");
	    }
	
	    /* 检查商品库存,如果使用库存,且下订单时减库存,则减少库存 */
	    if ($_CFG['use_storage'] == '1' && $_CFG['stock_dec_time'] == SDT_PLACE)
	    {
	        $cart_goods_stock = get_cart_goods();       
	        $_cart_goods_stock = array();        
	        foreach ($cart_goods_stock['goods_list'] as $value)
	        {
	            $_cart_goods_stock[$value['rec_id']] = $value['goods_number'];
	        }       
	        zy_flow_cart_stock($_cart_goods_stock);        
	        unset($cart_goods_stock, $_cart_goods_stock);
	    }
	
	    /*
	     * 检查用户是否已经登录
	     * 如果用户已经登录了则检查是否有默认的收货地址
	     * 如果没有登录则跳转到登录和注册页面
	     */
	    if (empty($_SESSION['direct_shopping']) && $_SESSION['user_id'] == 0)
	    {
	        /* 用户没有登录且没有选定匿名购物,转向到登录页面 */
	        $msg = rpcLang('user.php', 'nologin');
			jsonExit("{\"status\":\"$msg\"}");
	    }
	
	    $consignee = get_consignee($_SESSION['user_id']);
	
	    /* 检查收货人信息是否完整 */
	    if (!check_consignee_info($consignee, $flow_type))
	    {
	        $msg = rpcLang('flow.php', 'user_address_not_full');
			jsonExit("{\"status\":\"$msg\"}");
	    }
	
	
	    $_GET['how_oos']	  = isset($_GET['how_oos']) ? intval($_GET['how_oos']) : 0;
	    $_GET['card_message'] = isset($_GET['card_message']) ? htmlspecialchars($_GET['card_message']) : '';
	    $_GET['inv_type']     = !empty($_GET['inv_type']) ? htmlspecialchars($_GET['inv_type']) : '';
	    $_GET['inv_payee']    = isset($_GET['inv_payee']) ? htmlspecialchars($_GET['inv_payee']) : '';
	    $_GET['inv_content']  = isset($_GET['inv_content']) ? htmlspecialchars($_GET['inv_content']) : '';
	    $_GET['postscript']   = isset($_GET['postscript']) ? htmlspecialchars($_GET['postscript']) : '';
	
	    $referer = empty($_GET['referer']) ? 'Android':trim($_GET['referer']);
	    $order = array(
	        //'shipping_id'     => intval($_POST['shipping']),
	    	'shipping_id'     => intval($_GET['shipping']),//快递id
	        'pay_id'          => intval($_GET['payment']),//支付方式id
	        'pack_id'         => isset($_GET['pack']) ? intval($_GET['pack']) : 0,//包装
	        'card_id'         => isset($_GET['card']) ? intval($_GET['card']) : 0,//贺卡
	        'card_message'    => trim($_GET['card_message']),
	        'surplus'         => isset($_POST['surplus']) ? floatval($_POST['surplus']) : 0.00,
	        'integral'        => isset($_POST['integral']) ? intval($_POST['integral']) : 0,
	        'bonus_id'        => isset($_GET['bonus']) ? intval($_GET['bonus']) : 0,
	        'need_inv'        => empty($_POST['need_inv']) ? 0 : 1,
	        'postscript'      => trim($_POST['postscript']),
	        'how_oos'         => isset($_LANG['oos'][$_POST['how_oos']]) ? addslashes($_LANG['oos'][$_POST['how_oos']]) : '',
	        'need_insure'     => isset($_POST['need_insure']) ? intval($_POST['need_insure']) : 0,
	        'user_id'         => $_SESSION['user_id'],
	        'add_time'        => gmtime(),
	        'order_status'    => OS_UNCONFIRMED,
	        'shipping_status' => SS_UNSHIPPED,
	        'pay_status'      => PS_UNPAYED,
	        'agency_id'       => get_agency_by_regions(array($consignee['country'], $consignee['province'], $consignee['city'], $consignee['district']))
	        );
		if(EC_CHARSET == 'utf-8'){
			$order['inv_type'] = gbktoutf8($_GET['inv_type']);
			$order['inv_payee'] = gbktoutf8(trim($_GET['inv_payee']));
			$order['inv_content'] = gbktoutf8($_GET['inv_content']);
		}else{
			$order['inv_type'] = utf8togbk($_GET['inv_type']);
			$order['inv_payee'] = utf8togbk(trim($_GET['inv_payee']));
			$order['inv_content'] = utf8togbk($_GET['inv_content']);
		}
	
	    /* 扩展信息 */
	    if (isset($_SESSION['flow_type']) && intval($_SESSION['flow_type']) != CART_GENERAL_GOODS)
	    {
	        $order['extension_code'] = $_SESSION['extension_code'];
	        $order['extension_id'] = $_SESSION['extension_id'];
	    }
	    else
	    {
//.........这里部分代码省略.........
开发者ID:noikiy,项目名称:mdwp,代码行数:101,代码来源:flow.action.php

示例3: price_format

//        die(sprintf($_LANG['bonus_min_amount_error'], price_format($bonus['min_goods_amount'], false)));
//    }
//    die(sprintf($_LANG['bonus_is_ok'], price_format($bonus['type_money'], false)));
    $bonus_kill = price_format($bonus['type_money'], false);

    include_once('includes/cls_json.php');
    $result = array('error' => '', 'content' => '');

    /* 取得购物类型 */
    $flow_type = isset($_SESSION['flow_type']) ? intval($_SESSION['flow_type']) : CART_GENERAL_GOODS;

    /* 获得收货人信息 */
    $consignee = get_consignee($_SESSION['user_id']);

    /* 对商品信息赋值 */
    $cart_goods = cart_goods($flow_type); // 取得商品列表,计算合计

    if (empty($cart_goods) || !check_consignee_info($consignee, $flow_type))
    {
        $result['error'] = $_LANG['no_goods_in_cart'];
    }
    else
    {
        /* 取得购物流程设置 */
        $smarty->assign('config', $_CFG);

        /* 取得订单信息 */
        $order = flow_order_info();


        if (((!empty($bonus) && $bonus['user_id'] == $_SESSION['user_id']) || ($bonus['type_money'] > 0 && empty($bonus['user_id']))) && $bonus['order_id'] <= 0)
开发者ID:alphaouyang,项目名称:ecshop,代码行数:31,代码来源:flow.php

示例4: get_total_price_in_cart

 public static function get_total_price_in_cart()
 {
     global $db;
     global $ecs;
     include_once 'includes/lib_order.php';
     //取得购物类型
     $flow_type = isset($_SESSION['flow_type']) ? intval($_SESSION['flow_type']) : CART_GENERAL_GOODS;
     //团购标志
     if ($flow_type == CART_GROUP_BUY_GOODS) {
         //$smarty->assign('is_group_buy', 1);
     } elseif ($flow_type == CART_EXCHANGE_GOODS) {
         //$smarty->assign('is_exchange_goods', 1);
     } else {
         //正常购物流程  清空其他购物流程情况
         $_SESSION['flow_order']['extension_code'] = '';
     }
     //检查购物车中是否有商品
     $sql = "SELECT COUNT(*) FROM " . $ecs->table('cart') . " WHERE session_id = '" . SESS_ID . "' " . "AND parent_id = 0 AND is_gift = 0 AND rec_type = '{$flow_type}'";
     if ($db->getOne($sql) == 0) {
         return false;
     }
     /* 对商品信息赋值 */
     $cart_goods = cart_goods($flow_type);
     // 取得商品列表,计算合计
     $order = flow_order_info();
     $order['best_time'] = $_SESSION['flow_consignee']['best_time'];
     //计算折扣
     if ($flow_type != CART_EXCHANGE_GOODS && $flow_type != CART_GROUP_BUY_GOODS) {
         $discount = compute_discount();
         $favour_name = empty($discount['name']) ? '' : join(',', $discount['name']);
     }
     //计算订单的费用
     $total = order_fee($order, $cart_goods, $consignee);
     return $total;
     /*
     //蛋糕
     $sql = "select * from " . $ecs->table('cart') . " WHERE  session_id='" . SESS_ID . "'";
     $goods = $db->getAll($sql);
     $total = 0;
     foreach($goods as $val){
     	$total += $val['goods_price'] * $val['goods_number'];
     }
     
     //餐具
     if($_SESSION['extra_fork']==NULL){
        //$_SESSION['extra_fork'] = array();
     }else{
     	$forks = $_SESSION['extra_fork'];
     	foreach ($forks as $value){
     		$total+=($value*0.5);
     	}
     }
     
     //运费
     if($_SESSION['need_shipping_fee']){
     	$total+=$_SESSION['need_shipping_fee'];
     }
     return $total;
     */
 }
开发者ID:fromzyy2ann,项目名称:mescake,代码行数:60,代码来源:order.php


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