當前位置: 首頁>>代碼示例>>PHP>>正文


PHP shipping_area_info函數代碼示例

本文整理匯總了PHP中shipping_area_info函數的典型用法代碼示例。如果您正苦於以下問題:PHP shipping_area_info函數的具體用法?PHP shipping_area_info怎麽用?PHP shipping_area_info使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了shipping_area_info函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: user_info

 }
 /* 取得用戶信息 */
 $user = user_info($_SESSION['user_id']);
 /* 用戶帳戶餘額是否足夠 */
 if ($surplus > $user['user_money'] + $user['credit_line']) {
     $err->add($_LANG['error_surplus_not_enough']);
     $err->show($_LANG['order_detail'], 'user.php?act=order_detail&order_id=' . $order_id);
 }
 /* 修改訂單,重新計算支付費用 */
 $order['surplus'] += $surplus;
 $order['order_amount'] -= $surplus;
 if ($order['order_amount'] > 0) {
     $cod_fee = 0;
     if ($order['shipping_id'] > 0) {
         $regions = array($order['country'], $order['province'], $order['city'], $order['district']);
         $shipping = shipping_area_info($order['shipping_id'], $regions);
         if ($shipping['support_cod'] == '1') {
             $cod_fee = $shipping['pay_fee'];
         }
     }
     $pay_fee = 0;
     if ($order['pay_id'] > 0) {
         $pay_fee = pay_fee($order['pay_id'], $order['order_amount'], $cod_fee);
     }
     $order['pay_fee'] = $pay_fee;
     $order['order_amount'] += $pay_fee;
 }
 /* 如果全部支付,設為已確認、已付款 */
 if ($order['order_amount'] == 0) {
     if ($order['order_status'] == OS_UNCONFIRMED) {
         $order['order_status'] = OS_CONFIRMED;
開發者ID:BGCX261,項目名稱:zishashop-svn-to-git,代碼行數:31,代碼來源:user.php

示例2: action_act_edit_surplus

function action_act_edit_surplus()
{
    $user = $GLOBALS['user'];
    $_CFG = $GLOBALS['_CFG'];
    $_LANG = $GLOBALS['_LANG'];
    $smarty = $GLOBALS['smarty'];
    $db = $GLOBALS['db'];
    $ecs = $GLOBALS['ecs'];
    $user_id = $_SESSION['user_id'];
    /* 檢查是否登錄 */
    if ($_SESSION['user_id'] <= 0) {
        ecs_header("Location: ./\n");
        exit;
    }
    /* 檢查訂單號 */
    $order_id = intval($_POST['order_id']);
    if ($order_id <= 0) {
        ecs_header("Location: ./\n");
        exit;
    }
    /* 檢查餘額 */
    $surplus = floatval($_POST['surplus']);
    if ($surplus <= 0) {
        $err->add($_LANG['error_surplus_invalid']);
        $err->show($_LANG['order_detail'], 'user.php?act=order_detail&order_id=' . $order_id);
    }
    include_once ROOT_PATH . 'includes/lib_order.php';
    /* 取得訂單 */
    $order = order_info($order_id);
    if (empty($order)) {
        ecs_header("Location: ./\n");
        exit;
    }
    /* 檢查訂單用戶跟當前用戶是否一致 */
    if ($_SESSION['user_id'] != $order['user_id']) {
        ecs_header("Location: ./\n");
        exit;
    }
    /* 檢查訂單是否未付款,檢查應付款金額是否大於0 */
    if ($order['pay_status'] != PS_UNPAYED || $order['order_amount'] <= 0) {
        $err->add($_LANG['error_order_is_paid']);
        $err->show($_LANG['order_detail'], 'user.php?act=order_detail&order_id=' . $order_id);
    }
    /* 計算應付款金額(減去支付費用) */
    $order['order_amount'] -= $order['pay_fee'];
    /* 餘額是否超過了應付款金額,改為應付款金額 */
    if ($surplus > $order['order_amount']) {
        $surplus = $order['order_amount'];
    }
    /* 取得用戶信息 */
    $user = user_info($_SESSION['user_id']);
    /* 用戶帳戶餘額是否足夠 */
    if ($surplus > $user['user_money'] + $user['credit_line']) {
        $err->add($_LANG['error_surplus_not_enough']);
        $err->show($_LANG['order_detail'], 'user.php?act=order_detail&order_id=' . $order_id);
    }
    /* 修改訂單,重新計算支付費用 */
    $order['surplus'] += $surplus;
    $order['order_amount'] -= $surplus;
    if ($order['order_amount'] > 0) {
        $cod_fee = 0;
        if ($order['shipping_id'] > 0) {
            $regions = array($order['country'], $order['province'], $order['city'], $order['district']);
            $shipping = shipping_area_info($order['shipping_id'], $regions);
            if ($shipping['support_cod'] == '1') {
                $cod_fee = $shipping['pay_fee'];
            }
        }
        $pay_fee = 0;
        if ($order['pay_id'] > 0) {
            $pay_fee = pay_fee($order['pay_id'], $order['order_amount'], $cod_fee);
        }
        $order['pay_fee'] = $pay_fee;
        $order['order_amount'] += $pay_fee;
    }
    /* 如果全部支付,設為已確認、已付款 */
    if ($order['order_amount'] == 0) {
        if ($order['order_status'] == OS_UNCONFIRMED) {
            $order['order_status'] = OS_CONFIRMED;
            $order['confirm_time'] = gmtime();
        }
        $order['pay_status'] = PS_PAYED;
        $order['pay_time'] = gmtime();
    }
    $order = addslashes_deep($order);
    update_order($order_id, $order);
    /* 更新用戶餘額 */
    $change_desc = sprintf($_LANG['pay_order_by_surplus'], $order['order_sn']);
    log_account_change($user['user_id'], -1 * $surplus, 0, 0, 0, $change_desc);
    /* 跳轉 */
    ecs_header('Location: user.php?act=order_detail&order_id=' . $order_id . "\n");
    exit;
}
開發者ID:seanguo166,項目名稱:yinoos,代碼行數:93,代碼來源:user.php

示例3: 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

示例4: available_shipping_list

     $shipping_list = available_shipping_list($region_id_list);
     /* 取得配送費用 */
     $total = order_weight_price($order_id);
     foreach ($shipping_list as $key => $shipping) {
         $shipping_fee = shipping_fee($shipping['shipping_code'], unserialize($shipping['configure']), $total['weight'], $total['amount'], $total['number']);
         $shipping_list[$key]['shipping_fee'] = $shipping_fee;
         $shipping_list[$key]['format_shipping_fee'] = price_format($shipping_fee);
         $shipping_list[$key]['free_money'] = price_format($shipping['configure']['free_money']);
     }
     $smarty->assign('shipping_list', $shipping_list);
 } elseif ('payment' == $step) {
     /* 取得可用的支付方式列表 */
     if (exist_real_goods($order_id)) {
         /* 存在實體商品 */
         $region_id_list = array($order['country'], $order['province'], $order['city'], $order['district']);
         $shipping_area = shipping_area_info($order['shipping_id'], $region_id_list);
         $pay_fee = $shipping_area['support_cod'] == 1 ? $shipping_area['pay_fee'] : 0;
         $payment_list = available_payment_list($shipping_area['support_cod'], $pay_fee);
     } else {
         /* 不存在實體商品 */
         $payment_list = available_payment_list(false);
     }
     /* 過濾掉使用餘額支付 */
     foreach ($payment_list as $key => $payment) {
         if ($payment['pay_code'] == 'balance') {
             unset($payment_list[$key]);
         }
     }
     $smarty->assign('payment_list', $payment_list);
 } elseif ('other' == $step) {
     /* 查詢是否存在實體商品 */
開發者ID:norain2050,項目名稱:benhu,代碼行數:31,代碼來源:order.php

示例5: checkout


//.........這裏部分代碼省略.........
	    else
	    {
	        $shipping = shipping_info($order['shipping_id']);
	        $cod = $shipping['support_cod'];
	
	        if ($cod)
	        {
	            #如果是團購,且保證金大於0,不能使用貨到付款
	            if ($flow_type == CART_GROUP_BUY_GOODS)
	            {
	                $group_buy_id = $_SESSION['extension_id'];
	                if ($group_buy_id <= 0)
	                {
	                    show_message('error group_buy_id');
	                }
	                $group_buy = group_buy_info($group_buy_id);
	                if (empty($group_buy))
	                {
	                    show_message('group buy not exists: ' . $group_buy_id);
	                }
	
	                if ($group_buy['deposit'] > 0)
	                {
	                    $cod = false;
	                    $cod_fee = 0;
	
	                    #賦值保證金
	                    $smarty->assign('gb_deposit', $group_buy['deposit']);
	                }
	            }
	
	            if ($cod)
	            {
	                $shipping_area_info = shipping_area_info($order['shipping_id'], $region);
	                $cod_fee            = $shipping_area_info['pay_fee'];
	            }
	        }
	        else
	        {
	            $cod_fee = 0;
	        }
	    }
	    
	
	    # 給貨到付款的手續費加<span id>,以便改變配送的時候動態顯示
	    $payment_list = available_payment_list(1, $cod_fee);
	    if(isset($payment_list))
	    {
	        foreach ($payment_list as $key => $payment)
	        {
	            if ($payment['is_cod'] == '1')
	            {
	                $payment_list[$key]['format_pay_fee'] = '<span id="ECS_CODFEE">' . $payment['format_pay_fee'] . '</span>';
	            }
	            #如果有易寶神州行支付 如果訂單金額大於300 則不顯示
	            if ($payment['pay_code'] == 'yeepayszx' && $total['amount'] > 300)
	            {
	                unset($payment_list[$key]);
	            }
	            #如果有餘額支付
	            if ($payment['pay_code'] == 'balance')
	            {
	                #如果未登錄,不顯示
	                if ($_SESSION['user_id'] == 0)
	                {
	                    unset($payment_list[$key]);
開發者ID:noikiy,項目名稱:mdwp,代碼行數:67,代碼來源:flow.action.php

示例6: array

$shipping_id = $db->getOne($sql);
/* ajax獲取運費 */
if ($action == 'get_shipping_fee') {
    require ROOT_PATH . 'includes/cls_json.php';
    $region = array();
    $json = new JSON();
    $result = array('error' => 0, 'message' => '', 'content' => '');
    $_POST['goods'] = strip_tags(urldecode($_POST['goods']));
    $_POST['goods'] = json_str_iconv($_POST['goods']);
    $goods = $json->decode($_POST['goods']);
    $region['country'] = $goods->country;
    $region['province'] = $goods->province;
    $region['city'] = $goods->city;
    $region['district'] = $goods->district;
    $goods_weight = $goods->goods_weight;
    $shipping_info = shipping_area_info($shipping_id, $region);
    $shipping_fee = shipping_fee($shipping_info['shipping_code'], $shipping_info['configure'], $goods_weight, '0', '0');
    $result['content'] = $shipping_fee;
    die($json->encode($result));
}
/* ajax獲取運單狀態 */
if ($action == 'get_OrderStatus') {
    require ROOT_PATH . 'includes/cls_json.php';
    require ROOT_PATH . 'includes/cls_captcha.php';
    $json = new JSON();
    $result = array('error' => 0, 'message' => '', 'content' => '');
    $_POST['order'] = strip_tags(urldecode($_POST['order']));
    $_POST['order'] = json_str_iconv($_POST['order']);
    $order = $json->decode($_POST['order']);
    $validator = new captcha();
    if (!$validator->check_word($order->captcha)) {
開發者ID:seanguo166,項目名稱:yinoos,代碼行數:31,代碼來源:kuaidi.php


注:本文中的shipping_area_info函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。