當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。