本文整理匯總了PHP中shipping_fee函數的典型用法代碼示例。如果您正苦於以下問題:PHP shipping_fee函數的具體用法?PHP shipping_fee怎麽用?PHP shipping_fee使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了shipping_fee函數的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: elseif
}
}
}
}
} elseif ('shipping' == $step) {
/* 如果不存在實體商品 */
if (!exist_real_goods($order_id)) {
die('Hacking Attemp');
}
/* 取得可用的配送方式列表 */
$region_id_list = array($order['country'], $order['province'], $order['city'], $order['district']);
$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 {
/* 不存在實體商品 */
示例2: 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;
//.........這裏部分代碼省略.........
示例3: order_fee
/**
* 獲得訂單中的費用信息
*
* @access public
* @param array $order
* @param array $goods
* @param array $consignee
* @param bool $is_gb_deposit 是否團購保證金(如果是,應付款金額隻計算商品總額和支付費用,可以獲得的積分取 $gift_integral)
* @return array
*/
function order_fee($order, $goods, $consignee)
{
/* 初始化訂單的擴展code */
if (!isset($order['extension_code'])) {
$order['extension_code'] = '';
}
if ($order['extension_code'] == 'group_buy') {
$group_buy = model('GroupBuyBase')->group_buy_info($order['extension_id']);
}
$total = array('real_goods_count' => 0, 'gift_amount' => 0, 'goods_price' => 0, 'market_price' => 0, 'discount' => 0, 'pack_fee' => 0, 'card_fee' => 0, 'shipping_fee' => 0, 'shipping_insure' => 0, 'integral_money' => 0, 'bonus' => 0, 'surplus' => 0, 'cod_fee' => 0, 'pay_fee' => 0, 'tax' => 0);
$weight = 0;
/* 商品總價 */
foreach ($goods as $val) {
/* 統計實體商品的個數 */
if ($val['is_real']) {
$total['real_goods_count']++;
}
$total['goods_price'] += $val['goods_price'] * $val['goods_number'];
$total['market_price'] += $val['market_price'] * $val['goods_number'];
}
$total['saving'] = $total['market_price'] - $total['goods_price'];
$total['save_rate'] = $total['market_price'] ? round($total['saving'] * 100 / $total['market_price']) . '%' : 0;
$total['goods_price_formated'] = price_format($total['goods_price'], false);
$total['market_price_formated'] = price_format($total['market_price'], false);
$total['saving_formated'] = price_format($total['saving'], false);
/* 折扣 */
if ($order['extension_code'] != 'group_buy') {
$discount = model('Order')->compute_discount();
$total['discount'] = $discount['discount'];
if ($total['discount'] > $total['goods_price']) {
$total['discount'] = $total['goods_price'];
}
}
$total['discount_formated'] = price_format($total['discount'], false);
/* 稅額 */
if (!empty($order['need_inv']) && $order['inv_type'] != '') {
/* 查稅率 */
$rate = 0;
$invoice_type = C('invoice_type');
foreach ($invoice_type['type'] as $key => $type) {
if ($type == $order['inv_type']) {
$rate = floatval($invoice_type['rate'][$key]) / 100;
break;
}
}
if ($rate > 0) {
$total['tax'] = $rate * $total['goods_price'];
}
}
$total['tax_formated'] = price_format($total['tax'], false);
/* 包裝費用 */
if (!empty($order['pack_id'])) {
$total['pack_fee'] = pack_fee($order['pack_id'], $total['goods_price']);
}
$total['pack_fee_formated'] = price_format($total['pack_fee'], false);
/* 賀卡費用 */
if (!empty($order['card_id'])) {
$total['card_fee'] = card_fee($order['card_id'], $total['goods_price']);
}
$total['card_fee_formated'] = price_format($total['card_fee'], false);
/* 紅包 */
if (!empty($order['bonus_id'])) {
$bonus = model('Order')->bonus_info($order['bonus_id']);
$total['bonus'] = $bonus['type_money'];
}
$total['bonus_formated'] = price_format($total['bonus'], false);
/* 線下紅包 */
if (!empty($order['bonus_kill'])) {
$bonus = model('Order')->bonus_info(0, $order['bonus_kill']);
$total['bonus_kill'] = $order['bonus_kill'];
$total['bonus_kill_formated'] = price_format($total['bonus_kill'], false);
}
/* 配送費用 */
$shipping_cod_fee = NULL;
if ($order['shipping_id'] > 0 && $total['real_goods_count'] > 0) {
$region['country'] = $consignee['country'];
$region['province'] = $consignee['province'];
$region['city'] = $consignee['city'];
$region['district'] = $consignee['district'];
$shipping_info = model('Shipping')->shipping_area_info($order['shipping_id'], $region);
if (!empty($shipping_info)) {
if ($order['extension_code'] == 'group_buy') {
$weight_price = model('Order')->cart_weight_price(CART_GROUP_BUY_GOODS);
} else {
$weight_price = model('Order')->cart_weight_price();
}
// 查看購物車中是否全為免運費商品,若是則把運費賦為零
$sql = 'SELECT count(*) as count FROM ' . $this->pre . "cart WHERE `session_id` = '" . SESS_ID . "' AND `extension_code` != 'package_buy' AND `is_shipping` = 0";
$res = $this->row($sql);
$shipping_count = $res['count'];
//.........這裏部分代碼省略.........
示例4: order_fee
$total = order_fee($order, $cart_goods, $consignee);
$smarty->assign('shopping_money', sprintf($_LANG['shopping_money'], $total['formated_goods_price']));
$smarty->assign('market_price_desc', sprintf($_LANG['than_market_price'], $total['formated_market_price'], $total['formated_saving'], $total['save_rate']));
$smarty->assign('total', $total);
/* 取得配送列表 */
$region = array($consignee['country'], $consignee['province'], $consignee['city'], $consignee['district']);
$shipping_list = available_shipping_list($region);
$cart_weight_price = cart_weight_price($flow_type);
$insure_disabled = true;
$cod_disabled = true;
// 查看購物車中是否全為免運費商品,若是則把運費賦為零
$sql = 'SELECT count(*) FROM ' . $ecs->table('cart') . " WHERE `session_id` = '" . SESS_ID . "' AND `extension_code` != 'package_buy' AND `is_shipping` = 0";
$shipping_count = $db->getOne($sql);
foreach ($shipping_list as $key => $val) {
$shipping_cfg = unserialize_config($val['configure']);
$shipping_fee = ($shipping_count == 0 and $cart_weight_price['free_shipping'] == 1) ? 0 : shipping_fee($val['shipping_code'], unserialize($val['configure']), $cart_weight_price['weight'], $cart_weight_price['amount'], $cart_weight_price['number']);
$shipping_list[$key]['format_shipping_fee'] = price_format($shipping_fee, false);
$shipping_list[$key]['shipping_fee'] = $shipping_fee;
$shipping_list[$key]['free_money'] = price_format($shipping_cfg['free_money'], false);
$shipping_list[$key]['insure_formated'] = strpos($val['insure'], '%') === false ? price_format($val['insure'], false) : $val['insure'];
}
$smarty->assign('shipping_list', $shipping_list);
$smarty->assign('insure_disabled', $insure_disabled);
$smarty->assign('cod_disabled', $cod_disabled);
/* 取得支付列表 */
if ($order['shipping_id'] == 0) {
$cod = true;
$cod_fee = 0;
} else {
$shipping = shipping_info($order['shipping_id']);
$cod = $shipping['support_cod'];
示例5: elseif
}
exit;
}
} elseif ('shipping' == $step) {
/* 如果不存在實體商品,退出 */
if (!exist_real_goods($order_id)) {
die('Hacking Attemp');
}
/* 取得訂單信息 */
$order_info = order_info($order_id);
$region_id_list = array($order_info['country'], $order_info['province'], $order_info['city'], $order_info['district']);
/* 保存訂單 */
$shipping_id = $_POST['shipping'];
$shipping = shipping_area_info($shipping_id, $region_id_list);
$weight_amount = order_weight_price($order_id);
$shipping_fee = shipping_fee($shipping['shipping_code'], $shipping['configure'], $weight_amount['weight'], $weight_amount['amount'], $weight_amount['number']);
$order = array('shipping_id' => $shipping_id, 'shipping_name' => addslashes($shipping['shipping_name']), 'shipping_fee' => $shipping_fee);
if (isset($_POST['insure'])) {
/* 計算保價費 */
$order['insure_fee'] = shipping_insure_fee($shipping['shipping_code'], order_amount($order_id), $shipping['insure']);
} else {
$order['insure_fee'] = 0;
}
update_order($order_id, $order);
update_order_amount($order_id);
/* 更新 pay_log */
update_pay_log($order_id);
/* 清除首頁緩存:發貨單查詢 */
clear_cache_files('index.dwt');
/* todo 記錄日誌 */
$sn = $old_order['order_sn'];
示例6: get_shop_help
// 頁麵標題
$smarty->assign('ur_here', $position['ur_here']);
// 當前位置
$smarty->assign('helps', get_shop_help());
// 網店幫助
$smarty->assign('lang', $_LANG);
$smarty->assign('choose', $choose);
$province_list[NULL] = get_regions(1, $choose['country']);
$city_list[NULL] = get_regions(2, $choose['province']);
$district_list[NULL] = get_regions(3, $choose['city']);
$smarty->assign('province_list', $province_list);
$smarty->assign('city_list', $city_list);
$smarty->assign('district_list', $district_list);
/* 取得國家列表、商店所在國家、商店所在國家的省列表 */
$smarty->assign('country_list', get_regions());
/* 取得配送列表 */
$region = array($choose['country'], $choose['province'], $choose['city'], $choose['district']);
$shipping_list = available_shipping_list($region);
$cart_weight_price = 0;
$insure_disabled = true;
$cod_disabled = true;
foreach ($shipping_list as $key => $val) {
$shipping_cfg = unserialize_config($val['configure']);
$shipping_fee = shipping_fee($val['shipping_code'], unserialize($val['configure']), $cart_weight_price['weight'], $cart_weight_price['amount']);
$shipping_list[$key]['format_shipping_fee'] = price_format($shipping_fee, false);
$shipping_list[$key]['fee'] = $shipping_fee;
$shipping_list[$key]['free_money'] = price_format($shipping_cfg['free_money'], false);
$shipping_list[$key]['insure_formated'] = strpos($val['insure'], '%') === false ? price_format($val['insure'], false) : $val['insure'];
}
$smarty->assign('shipping_list', $shipping_list);
$smarty->display('myship.dwt');
示例7: checkout
/**
* 訂單確認
*/
public function checkout()
{
/* 取得購物類型 */
$flow_type = isset($_SESSION['flow_type']) ? intval($_SESSION['flow_type']) : CART_GENERAL_GOODS;
/* 積分兌換商品 */
if ($flow_type == CART_EXCHANGE_GOODS) {
$this->assign('is_exchange_goods', 1);
} else {
// 正常購物流程 清空其他購物流程情況
$_SESSION['flow_order']['extension_code'] = '';
}
/* 檢查購物車中是否有商品 */
$condition = "session_id = '" . SESS_ID . "' " . "AND parent_id = 0 AND is_gift = 0 AND rec_type = '{$flow_type}'";
$count = $this->model->table('cart')->field('COUNT(*)')->where($condition)->getOne();
if ($count == 0) {
show_message(L('no_goods_in_cart'), '', '', 'warning');
}
// 檢查用戶是否已經登錄 如果用戶已經登錄了則檢查是否有默認的收貨地址 如果沒有登錄則跳轉到登錄和注冊頁麵
if (empty($_SESSION['direct_shopping']) && $_SESSION['user_id'] == 0) {
/* 用戶沒有登錄且沒有選定匿名購物,轉向到登錄頁麵 */
$this->redirect(url('user/login', array('step' => 'flow')));
exit;
}
// 獲取收貨人信息
$consignee = model('Order')->get_consignee($_SESSION['user_id']);
/* 檢查收貨人信息是否完整 */
if (!model('Order')->check_consignee_info($consignee, $flow_type)) {
/* 如果不完整則轉向到收貨人信息填寫界麵 */
ecs_header("Location: " . url('flow/consignee_list') . "\n");
}
// 獲取配送地址
$consignee_list = model('Users')->get_consignee_list($_SESSION['user_id']);
$this->assign('consignee_list', $consignee_list);
//獲取默認配送地址
$address_id = $this->model->table('users')->field('address_id')->where("user_id = '" . $_SESSION['user_id'] . "' ")->getOne();
$this->assign('address_id', $address_id);
$_SESSION['flow_consignee'] = $consignee;
$this->assign('consignee', $consignee);
/* 對商品信息賦值 */
$cart_goods = model('Order')->cart_goods($flow_type);
// 取得商品列表,計算合計
$this->assign('goods_list', $cart_goods);
/* 對是否允許修改購物車賦值 */
if ($flow_type != CART_GENERAL_GOODS || C('one_step_buy') == '1') {
$this->assign('allow_edit_cart', 0);
} else {
$this->assign('allow_edit_cart', 1);
}
// 取得購物流程設置
$this->assign('config', C('CFG'));
// 取得訂單信息
$order = model('Order')->flow_order_info();
$this->assign('order', $order);
/* 計算折扣 */
if ($flow_type != CART_EXCHANGE_GOODS) {
$discount = model('Order')->compute_discount();
$this->assign('discount', $discount['discount']);
$favour_name = empty($discount['name']) ? '' : join(',', $discount['name']);
$this->assign('your_discount', sprintf(L('your_discount'), $favour_name, price_format($discount['discount'])));
}
//計算訂單的費用
$total = model('Users')->order_fee($order, $cart_goods, $consignee);
$this->assign('total', $total);
$this->assign('shopping_money', sprintf(L('shopping_money'), $total['formated_goods_price']));
$this->assign('market_price_desc', sprintf(L('than_market_price'), $total['formated_market_price'], $total['formated_saving'], $total['save_rate']));
/* 取得可以得到的積分和紅包 */
$this->assign('total_integral', model('Order')->cart_amount(false, $flow_type) - $total['integral_money']);
/* 取得配送列表 */
$region = array($consignee['country'], $consignee['province'], $consignee['city'], $consignee['district']);
$shipping_list = model('Shipping')->available_shipping_list($region);
$cart_weight_price = model('Order')->cart_weight_price($flow_type);
$insure_disabled = true;
$cod_disabled = true;
// 查看購物車中是否全為免運費商品,若是則把運費賦為零
$condition = "`session_id` = '" . SESS_ID . "' AND `is_shipping` = 0";
$shipping_count = $this->model->table('cart')->field('count(*)')->where($condition)->getOne();
foreach ($shipping_list as $key => $val) {
$shipping_cfg = unserialize_config($val['configure']);
$shipping_fee = ($shipping_count == 0 and $cart_weight_price['free_shipping'] == 1) ? 0 : shipping_fee($val['shipping_code'], unserialize($val['configure']), $cart_weight_price['weight'], $cart_weight_price['amount'], $cart_weight_price['number']);
$shipping_list[$key]['format_shipping_fee'] = price_format($shipping_fee, false);
$shipping_list[$key]['shipping_fee'] = $shipping_fee;
$shipping_list[$key]['free_money'] = price_format($shipping_cfg['free_money'], false);
$shipping_list[$key]['insure_formated'] = strpos($val['insure'], '%') === false ? price_format($val['insure'], false) : $val['insure'];
/* 當前的配送方式是否支持保價 */
if ($val['shipping_id'] == $order['shipping_id']) {
$insure_disabled = $val['insure'] == 0;
$cod_disabled = $val['support_cod'] == 0;
}
// 兼容過濾ecjia配送方式
if (substr($val['shipping_code'], 0, 5) == 'ship_') {
unset($shipping_list[$key]);
}
}
$this->assign('shipping_list', $shipping_list);
$this->assign('insure_disabled', $insure_disabled);
$this->assign('cod_disabled', $cod_disabled);
/* 取得支付列表 */
//.........這裏部分代碼省略.........
示例8: create
//.........這裏部分代碼省略.........
if ($val['etime'] < time()) {
ajaxErrReturn($val['title'] . '促銷活動已結束');
}
}
}
//生成訂單
$model = M('Order');
$mem_model = M('Member');
$od_model = M('OrderDetail');
$time = time();
$model->startTrans();
//啟用事務
$mo_sn = '';
if (count($list2) > 1) {
$mo_sn = build_order_no($this->user['id']);
}
foreach ($list2 as $seller_id => $v) {
if ($seller_id != 0) {
//$mdata['id'] = $seller_id;
//$user = $mem_model->field('id,pid')->where($mdata)->find();
//$add_order['agent_id'] = $user['pid'];//代理商
$add_order['seller_id'] = $seller_id;
} else {
$add_order['agent_id'] = 0;
}
//訂單號
$order_sn = $add_order['order_sn'] = build_order_no($this->user['id']);
if ($mo_sn) {
$add_order['mo_sn'] = $mo_sn;
}
//商品總價
$add_order['total_fee'] = $v['total_fee'];
//郵費處理
$add_order['shipping_fee'] = shipping_fee($v['list'], $address);
$add_order['type'] = 1;
$add_order['title'] = '購買商品';
//優惠券處理
if ($_POST['coupon_user_id'] && $coupons2[$seller_id]) {
$add_order['coupons_fee'] = $coupons2[$seller_id]['value'];
} else {
$add_order['coupons_fee'] = 0;
}
//促銷價格
if ($_POST['sp_id'] && $proms2[$seller_id]) {
$options['prom_id'] = $proms2[$seller_id]['id'];
$prom = get_promotion($v['list'], $options);
if ($prom) {
$add_order['discount_fee'] = $prom[0]['award_value'];
}
} else {
$add_order['discount_fee'] = 0;
}
//實付價格 = 總價 - 優惠券價 - 促銷價 + 快遞費
$add_order['actual_paid'] = $add_order['total_fee'] - $add_order['coupons_fee'] - $add_order['discount_fee'] + $add_order['shipping_fee'];
//發票稅額
if ($this->configs['tax_rate'] && $_POST['tax']) {
$add_order['tax_fee'] = $add_order['actual_paid'] * $this->configs['tax_rate'] / 100;
} else {
$add_order['tax_fee'] = 0;
}
$add_order['tax_title'] = $_POST['tax_title'];
$add_order['tax_content'] = $_POST['tax_content'];
//總價 + 發票稅
$add_order['actual_paid'] = $add_order['actual_paid'] + $add_order['tax_fee'];
$add_order['bond'] = 0;
$add_order['total_num'] = $v['total_num'];
示例9: checkout
//.........這裏部分代碼省略.........
/*
* 取得訂單信息
*/
$order = flow_order_info();
/* 計算折扣 */
if ($flow_type != CART_EXCHANGE_GOODS && $flow_type != CART_GROUP_BUY_GOODS)
{
$discount = compute_discount();
}
/*
* 計算訂單的費用
*/
$total = order_fee($order, $cart_goods, $consignee);
#取得配送列表
$region = array($consignee['country'], $consignee['province'], $consignee['city'], $consignee['district']);
#快遞方式集合
$shipping_list = available_shipping_list($region);
#購物車重量
$cart_weight_price = cart_weight_price($flow_type);
$insure_disabled = true;
$cod_disabled = true;
#查看購物車中是否全為免運費商品,若是則把運費賦為零s
$sql = 'SELECT count(*) FROM ' . $ecs->table('cart') . " WHERE `session_id` = '" . SESS_ID. "' AND `extension_code` != 'package_buy' AND `is_shipping` = 0";
$shipping_count = $db->getOne($sql);
foreach ($shipping_list AS $key => $val)
{
$shipping_cfg = unserialize_config($val['configure']);
$shipping_fee = ($shipping_count == 0 AND $cart_weight_price['free_shipping'] == 1) ? 0 : shipping_fee($val['shipping_code'], unserialize($val['configure']),
$cart_weight_price['weight'], $cart_weight_price['amount'], $cart_weight_price['number']);
$shipping_list[$key]['format_shipping_fee'] = price_format($shipping_fee, false);
$shipping_list[$key]['shipping_fee'] = $shipping_fee;
$shipping_list[$key]['free_money'] = price_format($shipping_cfg['free_money'], false);
$shipping_list[$key]['insure_formated'] = strpos($val['insure'], '%') === false ?
price_format($val['insure'], false) : $val['insure'];
#當前的配送方式是否支持保價
if ($val['shipping_id'] == $order['shipping_id'])
{
$insure_disabled = ($val['insure'] == 0);
$cod_disabled = ($val['support_cod'] == 0);
}
}
#取得支付列表
if ($order['shipping_id'] == 0)
{
$cod = true;
$cod_fee = 0;
}
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'];
示例10: array
/* 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)) {
$result['content'] = '驗證碼不正確!';
示例11: array
$transportModel = !empty($_REQUEST['transportModel']) ? $_REQUEST['transportModel'] : '';
$postData = array(orderType => $orderType, qty => $qty, productAttr => $productAttr, qtyOfPackage => $qtyOfPackage, packWeight => $packWeight, packVolume => $packVolume, HSCode => $HSCode, originCityCode => $originCityCode, destCityCode => $destCityCode, transportModel => $transportModel);
$postUrl = "http://www.234plog.com/eCloudsService/ecshippingcost/";
//可做成配置項
echo json_encode(http_post($postUrl, $postData, $_COOKIE));
exit;
}
/*------------------------------------------------------ */
//-- PROCESSOR
/*------------------------------------------------------ */
//$sql ="select * from jindong_shipping WHERE shipping_id = 8";
//$res = $db->getAll($sql);
/*ross 在 產品詳情頁 顯示 運費*/
$shipping_list = available_shipping_list([2]);
foreach ($shipping_list as $key => $val) {
$shipping_fee = ($shipping_count == 0 and $cart_weight_price['free_shipping'] == 1) ? 0 : shipping_fee($val['shipping_code'], unserialize($val['configure']), $goods_weight, $goods_amount, 1);
}
$goods2 = get_goods_info($goods_id);
if ($goods2['is_shipping']) {
$shipping_fee = 0;
}
$smarty->assign('shipping_fee', $shipping_fee);
/*ross 在 產品詳情頁 顯示 運費*/
$cache_id = $goods_id . '-' . $_SESSION['user_rank'] . '-' . $_CFG['lang'];
$cache_id = sprintf('%X', crc32($cache_id));
if (!$smarty->is_cached('goods.dwt', $cache_id)) {
$smarty->assign('image_width', $_CFG['image_width']);
$smarty->assign('image_height', $_CFG['image_height']);
$smarty->assign('helps', get_shop_help());
// 網店幫助
$smarty->assign('id', $goods_id);
示例12: insert_get_shop_shipping
/**
* 獲取不同商家的運費方式
**/
function insert_get_shop_shipping($arr)
{
global $db, $ecs;
$need_cache = $GLOBALS['smarty']->caching;
$need_compile = $GLOBALS['smarty']->force_compile;
$order = $_SESSION['flow_order'];
//獲取訂單信息
$suppid = intval($arr['suppid']);
$consignee = $arr['consignee'];
$flow_type = $arr['flow_type'];
$region = array($consignee['country'], $consignee['province'], $consignee['city'], $consignee['district']);
$shipping_list = available_shipping_list($region, $suppid);
$cart_weight_price = cart_weight_price2($flow_type, $suppid);
if (count($shipping_list) > 0) {
//獲取當前地址下所有的配送方式
$shipping_id = array();
foreach ($shipping_list as $v) {
$shipping_id[] = $v['shipping_id'];
}
$i = 0;
$sql_where = $_SESSION['user_id'] > 0 ? "user_id='" . $_SESSION['user_id'] . "' " : "session_id = '" . SESS_ID . "' AND user_id=0 ";
$sql = 'SELECT count(*) FROM ' . $ecs->table('cart') . " WHERE {$sql_where} AND `extension_code` != 'package_buy' AND `is_shipping` = 0 AND rec_id in (" . $_SESSION['sel_cartgoods'] . ")";
//jx
$shipping_count = $db->getOne($sql);
foreach ($shipping_list as $key => $val) {
$shipping_cfg = unserialize_config($val['configure']);
$shipping_fee = $shipping_count == 0 && $cart_weight_price['free_shipping'] == 1 ? 0 : shipping_fee($val['shipping_code'], unserialize($val['configure']), $cart_weight_price['weight'], $cart_weight_price['amount'], $cart_weight_price['number']);
$shipping_list[$key]['format_shipping_fee'] = price_format($shipping_fee, false);
$shipping_list[$key]['shipping_fee'] = $shipping_fee;
$shipping_list[$key]['free_money'] = price_format($shipping_cfg['free_money'], false);
$shipping_list[$key]['insure_formated'] = strpos($val['insure'], '%') === false ? price_format($val['insure'], false) : $val['insure'];
$selected = '';
if ($i == 0 && !in_array($order['shipping_pay'][$suppid], $shipping_id)) {
$selected = 'selected';
$order['shipping_pay'][$suppid] = $val['shipping_id'];
//記錄第一個被選中的配送方式的id
}
if (isset($order['shipping_pay'][$suppid]) && intval($order['shipping_pay'][$suppid]) == $val['shipping_id'] && in_array($order['shipping_pay'][$suppid], $shipping_id)) {
$selected = 'selected';
}
$shipping_list[$key]['selected'] = $selected;
// 當前的配送方式是否支持保價
if ($val['shipping_id'] == $order['shipping_id']) {
$insure_disabled = $val['insure'] == 0;
$cod_disabled = $val['support_cod'] == 0;
}
}
}
$GLOBALS['smarty']->assign('suppid', $suppid);
$GLOBALS['smarty']->assign('shipping_list', $shipping_list);
$GLOBALS['smarty']->assign('insure_disabled', $insure_disabled);
$GLOBALS['smarty']->assign('cod_disabled', $cod_disabled);
$GLOBALS['smarty']->caching = $need_cache;
$GLOBALS['smarty']->force_compile = $need_compile;
$val = $GLOBALS['smarty']->fetch('library/shipping_list.lbi');
$_SESSION['flow_order'] = $order;
return $val;
}
示例13: array
$transportModel = !empty($_REQUEST['transportModel']) ? $_REQUEST['transportModel'] : '';
$postData = array(orderType => $orderType, qty => $qty, productAttr => $productAttr, qtyOfPackage => $qtyOfPackage, packWeight => $packWeight, packVolume => $packVolume, HSCode => $HSCode, originCityCode => $originCityCode, destCityCode => $destCityCode, transportModel => $transportModel);
$postUrl = "http://www.234plog.com/eCloudsService/ecshippingcost/";
//可做成配置項
echo json_encode(http_post($postUrl, $postData, $_COOKIE));
exit;
}
/*------------------------------------------------------ */
//-- PROCESSOR
/*------------------------------------------------------ */
//$sql ="select * from jindong_shipping WHERE shipping_id = 8";
//$res = $db->getAll($sql);
/*ross 在 產品詳情頁 顯示 運費*/
$shipping_list = available_shipping_list([2]);
foreach ($shipping_list as $key => $val) {
$shipping_fee = ($shipping_count == 0 and $cart_weight_price['free_shipping'] == 1) ? 0 : shipping_fee($val['shipping_code'], unserialize($val['configure']), 152.4, 3840, 1);
}
$goods2 = get_goods_info($goods_id);
if ($goods2['is_shipping']) {
$shipping_fee = 0;
}
$smarty->assign('shipping_fee', $shipping_fee);
/*ross 在 產品詳情頁 顯示 運費*/
$cache_id = $goods_id . '-' . $_SESSION['user_rank'] . '-' . $_CFG['lang'];
$cache_id = sprintf('%X', crc32($cache_id));
if (!$smarty->is_cached('goods.dwt', $cache_id)) {
$smarty->assign('image_width', $_CFG['image_width']);
$smarty->assign('image_height', $_CFG['image_height']);
$smarty->assign('helps', get_shop_help());
// 網店幫助
$smarty->assign('id', $goods_id);