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


PHP shipping_fee函数代码示例

本文整理汇总了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 {
         /* 不存在实体商品 */
开发者ID:norain2050,项目名称:benhu,代码行数:31,代码来源:order.php

示例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;
//.........这里部分代码省略.........
开发者ID:dlpc,项目名称:ecshop,代码行数:101,代码来源:lib_order.php

示例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'];
//.........这里部分代码省略.........
开发者ID:m7720647,项目名称:demo,代码行数:101,代码来源:UsersModel.class.php

示例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'];
开发者ID:a494008974,项目名称:bzbshop,代码行数:31,代码来源:order.php

示例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'];
开发者ID:seanguo166,项目名称:yinoos,代码行数:31,代码来源:order.php

示例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');
开发者ID:dw250100785,项目名称:ECShop-1,代码行数:31,代码来源:myship.php

示例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);
     /* 取得支付列表 */
//.........这里部分代码省略.........
开发者ID:noikiy,项目名称:shop-3,代码行数:101,代码来源:FlowController.class.php

示例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'];
开发者ID:8yong8,项目名称:vshop,代码行数:67,代码来源:OrderAction.class.php

示例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'];
开发者ID:noikiy,项目名称:mdwp,代码行数:67,代码来源:flow.action.php

示例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'] = '验证码不正确!';
开发者ID:seanguo166,项目名称:yinoos,代码行数:31,代码来源:kuaidi.php

示例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);
开发者ID:jinjiang2009,项目名称:exiao_online,代码行数:31,代码来源:goods.php

示例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;
}
开发者ID:seanguo166,项目名称:yinoos,代码行数:61,代码来源:lib_insert.php

示例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);
开发者ID:jinjiang2009,项目名称:exiao_online,代码行数:31,代码来源:goods_bak_150915.php


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