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


PHP cart_amount函数代码示例

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


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

示例1: flow_order_info

        $result['error'] = '您的购物车中没有商品!';
    } else {
        /* 取得购物流程设置 */
        $smarty->assign('config', $_CFG);
        /* 取得订单信息 */
        $order = flow_order_info();
        $order['pay_id'] = intval($_REQUEST['payment']);
        $payment_info = payment_info($order['pay_id']);
        $result['pay_code'] = $payment_info['pay_code'];
        /* 保存 session */
        $_SESSION['flow_order'] = $order;
        /* 计算订单的费用 */
        $total = order_fee($order, $cart_goods, $consignee);
        $smarty->assign('total', $total);
        /* 取得可以得到的积分和红包 */
        $smarty->assign('total_integral', cart_amount(false, $flow_type) - $total['bonus'] - $total['integral_money']);
        $smarty->assign('total_bonus', price_format(get_total_bonus(), false));
        /* 团购标志 */
        if ($flow_type == CART_GROUP_BUY_GOODS) {
            $smarty->assign('is_group_buy', 1);
        }
        $result['content'] = $smarty->fetch('order_total.html');
    }
    echo $json->encode($result);
    exit;
} elseif ($_REQUEST['act'] == 'change_surplus') {
    /*------------------------------------------------------ */
    //-- 改变余额
    /*------------------------------------------------------ */
    include_once 'includes/cls_json.php';
    $surplus = floatval($_GET['surplus']);
开发者ID:a494008974,项目名称:bzbshop,代码行数:31,代码来源:order.php

示例2: bonus_info

 } else {
     $order['surplus'] = 0;
     $order['integral'] = 0;
 }
 /* 检查抵扣券是否存在 */
 if ($order['bonus_id'] > 0) {
     $bonus = bonus_info($order['bonus_id']);
     if (empty($bonus) || $bonus['user_id'] != $user_id || $bonus['order_id'] > 0 || $bonus['min_goods_amount'] > cart_amount(true, $flow_type)) {
         $order['bonus_id'] = 0;
     }
 } elseif (isset($_POST['bonus_sn'])) {
     $flow_type = isset($_SESSION['flow_type']) ? intval($_SESSION['flow_type']) : CART_GENERAL_GOODS;
     $bonus_sn = trim($_POST['bonus_sn']);
     $bonus = bonus_info(0, $bonus_sn);
     $now = gmtime();
     if (empty($bonus) || $bonus['user_id'] > 0 || $bonus['order_id'] > 0 || $bonus['min_goods_amount'] > cart_amount(true, $flow_type) || $now > $bonus['use_end_date']) {
     } else {
         if ($user_id > 0) {
             $sql = "UPDATE " . $ecs->table('user_bonus') . " SET user_id = '{$user_id}' WHERE bonus_id = '{$bonus['bonus_id']}' LIMIT 1";
             $db->query($sql);
         }
         $order['bonus_id'] = $bonus['bonus_id'];
         $order['bonus_sn'] = $bonus_sn;
     }
 }
 /* 订单中的商品 */
 $cart_goods = cart_goods($flow_type);
 if (empty($cart_goods)) {
     $tips = '您的购物车中没有商品';
     $smarty->assign('footer', get_footer());
     $smarty->assign('tips', $tips);
开发者ID:nanhuacrab,项目名称:ecshop,代码行数:31,代码来源:order.php

示例3: cart_goods

     } else {
         if ($user_id > 0) {
             $sql = "UPDATE " . $ecs->table('user_bonus') . " SET user_id = '{$user_id}' WHERE bonus_id = '{$bonus['bonus_id']}' LIMIT 1";
             $db->query($sql);
         }
         $order['bonus_id'] = $bonus['bonus_id'];
         $order['bonus_sn'] = $bonus_sn;
     }
 }
 /* 订单中的商品 */
 $cart_goods = cart_goods($flow_type);
 if (empty($cart_goods)) {
     show_message($_LANG['no_goods_in_cart'], $_LANG['back_home'], './', 'warning');
 }
 /* 检查商品总额是否达到最低限购金额 */
 if ($flow_type == CART_GENERAL_GOODS && cart_amount(true, CART_GENERAL_GOODS) < $_CFG['min_goods_amount']) {
     show_message(sprintf($_LANG['goods_amount_not_enough'], price_format($_CFG['min_goods_amount'], false)));
 }
 /* 收货人信息 */
 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'];
 // 购物车中的商品能享受红包支付的总额
 $discount_amout = compute_discount_amount();
开发者ID:will0306,项目名称:bianli100,代码行数:31,代码来源:flow.php

示例4: done


//.........这里部分代码省略.........
	    #检查积分余额是否合法
	    $user_id = $_SESSION['user_id'];
	    if ($user_id > 0)
	    {
	        $user_info = user_info($user_id);
	
	        $order['surplus'] = min($order['surplus'], $user_info['user_money'] + $user_info['credit_line']);
	        if ($order['surplus'] < 0)
	        {
	            $order['surplus'] = 0;
	        }
	
	        // 查询用户有多少积分
	        $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;
	    }*/
	
	    #检查红包是否存在
	    if ($order['bonus_id'] > 0)
	    {
	        $bonus = bonus_info($order['bonus_id']);
	
	        if (empty($bonus) || $bonus['user_id'] != $user_id || $bonus['order_id'] > 0 || $bonus['min_goods_amount'] > cart_amount(true, $flow_type))
	        {
	            $order['bonus_id'] = 0;
	        }
	        
	    }
	    elseif (isset($_POST['bonus_sn']))
	    {
	        $bonus_sn = trim($_POST['bonus_sn']);
	        $bonus = bonus_info(0, $bonus_sn);
	        $now = gmtime();
	        if (empty($bonus) || $bonus['user_id'] > 0 || $bonus['order_id'] > 0 || $bonus['min_goods_amount'] > cart_amount(true, $flow_type) || $now > $bonus['use_end_date'])
	        {
	        }
	        else
	        {
	            if ($user_id > 0)
	            {
	                $sql = "UPDATE " . $ecs->table('user_bonus') . " SET user_id = '$user_id' WHERE bonus_id = '$bonus[bonus_id]' LIMIT 1";
	                $db->query($sql);
	            }
	            $order['bonus_id'] = $bonus['bonus_id'];
	            $order['bonus_sn'] = $bonus_sn;
	        }
	    }
		
	
	    /* 订单中的商品 */
	    $cart_goods = cart_goods($flow_type);
	
	    if (empty($cart_goods))
	    {
	        $msg = rpcLang('flow.php', 'no_goods_in_cart');
开发者ID:noikiy,项目名称:mdwp,代码行数:67,代码来源:flow.action.php

示例5: group_buy_info

     $group_buy = group_buy_info($_SESSION['extension_id'], $number);
     if (!is_numeric($number)) {
         $result['error'] = '1';
         $result['content'] = '请输入合法数量';
         die($json->encode($result));
     }
     if ($group_buy['restrict_amount'] > 0 && $number > $group_buy['restrict_amount'] - $group_buy['valid_goods']) {
         $result['error'] = '1';
         $restrict_amount = $group_buy['restrict_amount'] - $group_buy['valid_goods'];
         $result['content'] = '您最多可买' . $restrict_amount . '件';
         die($json->encode($result));
     }
     $sql = "UPDATE " . $GLOBALS['ecs']->table('cart') . " SET goods_number = '{$number}' WHERE rec_id = {$rec_id}";
     $GLOBALS['db']->query($sql);
     $subtotal = $GLOBALS['db']->getONE("select goods_price * goods_number AS subtotal from " . $GLOBALS['ecs']->table('cart') . " where rec_id = {$rec_id}");
     $cart_amount = cart_amount($_SESSION['flow_type']);
     $result['subtotal'] = price_format($subtotal, false);
     $result['cart_amount'] = price_format($cart_amount, false);
     $result['rec_id'] = $rec_id;
     die($json->encode($result));
 } else {
     /* 标记购物流程为普通商品 */
     $_SESSION['flow_type'] = CART_GENERAL_GOODS;
     /* 检查是否需要注册码 */
     $captcha = intval($_CFG['captcha']);
     if ($captcha & CAPTCHA_LOGIN && (!($captcha & CAPTCHA_LOGIN_FAIL) || $captcha & CAPTCHA_LOGIN_FAIL && $_SESSION['login_fail'] > 2) && gd_version() > 0) {
         $smarty->assign('enabled_login_captcha', 1);
         $smarty->assign('rand', mt_rand());
     }
     if ($captcha & CAPTCHA_REGISTER) {
         $smarty->assign('enabled_register_captcha', 1);
开发者ID:norain2050,项目名称:benhu,代码行数:31,代码来源:flow.php

示例6: gmtime

        if (empty($count)) {
            $time = gmtime();
            $sql = "INSERT INTO " . $GLOBALS['ecs']->table('collect_goods') . " (user_id, goods_id, add_time)" . "VALUES ('{$_SESSION['user_id']}', '{$goods_id}', '{$time}')";
            $db->query($sql);
        }
        flow_drop_cart_goods($rec_id);
    }
    ecs_header("Location: flow.php\n");
    exit;
} elseif ($_REQUEST['step'] == 'validate_bonus') {
    $bonus_sn = trim($_GET['bonus_sn']);
    $bonus = bonus_info(0, $bonus_sn);
    if (empty($bonus) || $bonus['user_id'] > 0 || $bonus['order_id'] > 0) {
        die($_LANG['bonus_sn_error']);
    }
    if ($bonus['min_goods_amount'] > cart_amount()) {
        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)));
} elseif ($_REQUEST['step'] == 'add_package_to_cart') {
    include_once 'includes/cls_json.php';
    $_POST['package_info'] = json_str_iconv($_POST['package_info']);
    $result = array('error' => 0, 'message' => '', 'content' => '', 'package_id' => '');
    $json = new JSON();
    if (empty($_POST['package_info'])) {
        $result['error'] = 1;
        die($json->encode($result));
    }
    $package = $json->decode($_POST['package_info']);
    /* 如果是一步购物,先清空购物车 */
    if ($_CFG['one_step_buy'] == '1') {
开发者ID:BGCX261,项目名称:zishashop-svn-to-git,代码行数:31,代码来源:flow.php


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