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


PHP pack_info函数代码示例

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


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

示例1: merge_order

/**
 * 合并订单
 * @param   string  $from_order_sn  从订单号
 * @param   string  $to_order_sn    主订单号
 * @return  成功返回true,失败返回错误信息
 */
function merge_order($from_order_sn, $to_order_sn)
{
    /* 订单号不能为空 */
    if (trim($from_order_sn) == '' || trim($to_order_sn) == '') {
        return $GLOBALS['_LANG']['order_sn_not_null'];
    }
    /* 订单号不能相同 */
    if ($from_order_sn == $to_order_sn) {
        return $GLOBALS['_LANG']['two_order_sn_same'];
    }
    /* 取得订单信息 */
    $from_order = order_info(0, $from_order_sn);
    $to_order = order_info(0, $to_order_sn);
    /* 检查订单是否存在 */
    if (!$from_order) {
        return sprintf($GLOBALS['_LANG']['order_not_exist'], $from_order_sn);
    } elseif (!$to_order) {
        return sprintf($GLOBALS['_LANG']['order_not_exist'], $to_order_sn);
    }
    /* 检查合并的订单是否为普通订单,非普通订单不允许合并 */
    if ($from_order['extension_code'] != '' || $to_order['extension_code'] != 0) {
        return $GLOBALS['_LANG']['merge_invalid_order'];
    }
    /* 检查订单状态是否是已确认或未确认、未付款、未发货 */
    if ($from_order['order_status'] != OS_UNCONFIRMED && $from_order['order_status'] != OS_CONFIRMED) {
        return sprintf($GLOBALS['_LANG']['os_not_unconfirmed_or_confirmed'], $from_order_sn);
    } elseif ($from_order['pay_status'] != PS_UNPAYED) {
        return sprintf($GLOBALS['_LANG']['ps_not_unpayed'], $from_order_sn);
    } elseif ($from_order['shipping_status'] != SS_UNSHIPPED) {
        return sprintf($GLOBALS['_LANG']['ss_not_unshipped'], $from_order_sn);
    }
    if ($to_order['order_status'] != OS_UNCONFIRMED && $to_order['order_status'] != OS_CONFIRMED) {
        return sprintf($GLOBALS['_LANG']['os_not_unconfirmed_or_confirmed'], $to_order_sn);
    } elseif ($to_order['pay_status'] != PS_UNPAYED) {
        return sprintf($GLOBALS['_LANG']['ps_not_unpayed'], $to_order_sn);
    } elseif ($to_order['shipping_status'] != SS_UNSHIPPED) {
        return sprintf($GLOBALS['_LANG']['ss_not_unshipped'], $to_order_sn);
    }
    /* 检查订单用户是否相同 */
    if ($from_order['user_id'] != $to_order['user_id']) {
        return $GLOBALS['_LANG']['order_user_not_same'];
    }
    /* 合并订单 */
    $order = $to_order;
    $order['order_id'] = '';
    $order['add_time'] = gmtime();
    // 合并商品总额
    $order['goods_amount'] += $from_order['goods_amount'];
    // 合并折扣
    $order['discount'] += $from_order['discount'];
    if ($order['shipping_id'] > 0) {
        // 重新计算配送费用
        $weight_price = order_weight_price($to_order['order_id']);
        $from_weight_price = order_weight_price($from_order['order_id']);
        $weight_price['weight'] += $from_weight_price['weight'];
        $weight_price['amount'] += $from_weight_price['amount'];
        $weight_price['number'] += $from_weight_price['number'];
        $region_id_list = array($order['country'], $order['province'], $order['city'], $order['district']);
        $shipping_area = shipping_area_info($order['shipping_id'], $region_id_list);
        $order['shipping_fee'] = shipping_fee($shipping_area['shipping_code'], unserialize($shipping_area['configure']), $weight_price['weight'], $weight_price['amount'], $weight_price['number']);
        // 如果保价了,重新计算保价费
        if ($order['insure_fee'] > 0) {
            $order['insure_fee'] = shipping_insure_fee($shipping_area['shipping_code'], $order['goods_amount'], $shipping_area['insure']);
        }
    }
    // 重新计算包装费、贺卡费
    if ($order['pack_id'] > 0) {
        $pack = pack_info($order['pack_id']);
        $order['pack_fee'] = $pack['free_money'] > $order['goods_amount'] ? $pack['pack_fee'] : 0;
    }
    if ($order['card_id'] > 0) {
        $card = card_info($order['card_id']);
        $order['card_fee'] = $card['free_money'] > $order['goods_amount'] ? $card['card_fee'] : 0;
    }
    // 红包不变,合并积分、余额、已付款金额
    $order['integral'] += $from_order['integral'];
    $order['integral_money'] = value_of_integral($order['integral']);
    $order['surplus'] += $from_order['surplus'];
    $order['money_paid'] += $from_order['money_paid'];
    // 计算应付款金额(不包括支付费用)
    $order['order_amount'] = $order['goods_amount'] - $order['discount'] + $order['shipping_fee'] + $order['insure_fee'] + $order['pack_fee'] + $order['card_fee'] - $order['bonus'] - $order['integral_money'] - $order['surplus'] - $order['money_paid'];
    // 重新计算支付费
    if ($order['pay_id'] > 0) {
        // 货到付款手续费
        $cod_fee = $shipping_area ? $shipping_area['pay_fee'] : 0;
        $order['pay_fee'] = pay_fee($order['pay_id'], $order['order_amount'], $cod_fee);
        // 应付款金额加上支付费
        $order['order_amount'] += $order['pay_fee'];
    }
    /* 插入订单表 */
    do {
        $order['order_sn'] = get_order_sn();
        if ($GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('order_info'), addslashes_deep($order), 'INSERT')) {
            break;
//.........这里部分代码省略.........
开发者ID:dlpc,项目名称:ecshop,代码行数:101,代码来源:lib_order.php

示例2: shipping_info

 if ($order['shipping_id'] > 0) {
     $shipping = shipping_info($order['shipping_id']);
     $order['shipping_name'] = addslashes($shipping['shipping_name']);
 }
 $order['shipping_fee'] = $total['shipping_fee'];
 $order['insure_fee'] = $total['shipping_insure'];
 /* 支付方式 */
 if ($order['pay_id'] > 0) {
     $payment = payment_info($order['pay_id']);
     $order['pay_name'] = addslashes($payment['pay_name']);
 }
 $order['pay_fee'] = $total['pay_fee'];
 $order['cod_fee'] = $total['cod_fee'];
 /* 商品包装 */
 if ($order['pack_id'] > 0) {
     $pack = pack_info($order['pack_id']);
     $order['pack_name'] = addslashes($pack['pack_name']);
 }
 $order['pack_fee'] = $total['pack_fee'];
 /* 祝福贺卡 */
 if ($order['card_id'] > 0) {
     $card = card_info($order['card_id']);
     $order['card_name'] = addslashes($card['card_name']);
 }
 $order['card_fee'] = $total['card_fee'];
 $order['integral_money'] = $total['integral_money'];
 $order['integral'] = $total['integral'];
 if ($order['extension_code'] == 'exchange_goods') {
     $order['integral_money'] = 0;
     $order['integral'] = $total['exchange_integral'];
 }
开发者ID:nanhuacrab,项目名称:ecshop,代码行数:31,代码来源:order.php

示例3: order_info

         $order = order_info($order_id);
         handle_order_money_change($order, $msgs, $links);
         /* 显示提示信息 */
         if (!empty($msgs)) {
             sys_msg(join(chr(13), $msgs), 0, $links);
         } else {
             /* 完成 */
             ecs_header("Location: order.php?act=info&order_id=" . $order_id . "\n");
             exit;
         }
     }
 } elseif ('other' == $step) {
     /* 保存订单 */
     $order = array();
     if (isset($_POST['pack']) && $_POST['pack'] > 0) {
         $pack = pack_info($_POST['pack']);
         $order['pack_id'] = $pack['pack_id'];
         $order['pack_name'] = addslashes($pack['pack_name']);
         $order['pack_fee'] = $pack['pack_fee'];
     } else {
         $order['pack_id'] = 0;
         $order['pack_name'] = '';
         $order['pack_fee'] = 0;
     }
     if (isset($_POST['card']) && $_POST['card'] > 0) {
         $card = card_info($_POST['card']);
         $order['card_id'] = $card['card_id'];
         $order['card_name'] = addslashes($card['card_name']);
         $order['card_fee'] = $card['card_fee'];
         $order['card_message'] = $_POST['card_message'];
     } else {
开发者ID:norain2050,项目名称:benhu,代码行数:31,代码来源:order.php

示例4: done


//.........这里部分代码省略.........
	    $order['discount']     = $total['discount'];
	    $order['surplus']      = $total['surplus'];
	    $order['tax']          = $total['tax'];
	    #购物车中的商品能享受红包支付的总额
	    $discount_amout = compute_discount_amount();
		#红包和积分最多能支付的金额为商品总额
	    $temp_amout = $order['goods_amount'] - $discount_amout;
		if ($temp_amout <= 0)
	    {
	        $order['bonus_id'] = 0;
	    }
	
	    /* 配送方式 */
	    if ($order['shipping_id'] > 0)
	    {
	        $shipping = shipping_info($order['shipping_id']);
	        $order['shipping_name'] = addslashes($shipping['shipping_name']);
	    }
	    $order['shipping_fee'] = $total['shipping_fee'];
	    $order['insure_fee']   = $total['shipping_insure'];
	
	    /* 支付方式 */
	    if ($order['pay_id'] > 0)
	    {
	        $payment = payment_info($order['pay_id']);
	        $order['pay_name'] = addslashes($payment['pay_name']);
	    }
	    $order['pay_fee'] = $total['pay_fee'];
	    $order['cod_fee'] = $total['cod_fee'];
	
	    /* 商品包装 */
	    if ($order['pack_id'] > 0)
	    {
	        $pack               = pack_info($order['pack_id']);
	        $order['pack_name'] = addslashes($pack['pack_name']);
	    }
	    $order['pack_fee'] = $total['pack_fee'];
	
	
	    /* 祝福贺卡 */
	    if ($order['card_id'] > 0)
	    {
	        $card               = card_info($order['card_id']);
	        $order['card_name'] = addslashes($card['card_name']);
	    }
	    $order['card_fee']      = $total['card_fee'];
	
	    $order['order_amount']  = number_format($total['amount'], 2, '.', '');
	
	    /* 如果全部使用余额支付,检查余额是否足够 */
	    if ($payment['pay_code'] == 'balance' && $order['order_amount'] > 0)
	    {
	        if($order['surplus'] >0) //余额支付里如果输入了一个金额
	        {
	            $order['order_amount'] = $order['order_amount'] + $order['surplus'];
	            $order['surplus'] = 0;
	        }
	        if ($order['order_amount'] > ($user_info['user_money'] + $user_info['credit_line']))
	        {
	            show_message($_LANG['balance_not_enough']);
	        }
	        else
	        {
	            $order['surplus'] = $order['order_amount'];
	            $order['order_amount'] = 0;
	        }
开发者ID:noikiy,项目名称:mdwp,代码行数:67,代码来源:flow.action.php


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