wangtengyu
2018-12-07 f459412e0dac4ed94106da043b4c6f8576bfe496
commit | author | age
3e083b 1 <?php
B 2
3 /**
4  *  支付配送
5  */
6
7 define('IN_ECS', true);
8
9 require(dirname(__FILE__) . '/includes/init.php');
10 require_once(ROOT_PATH . 'includes/lib_order.php');
11 include_once(ROOT_PATH . 'includes/lib_transaction.php');
12
13 /* 载入语言文件 */
14 require_once(ROOT_PATH . 'languages/' .$_CFG['lang']. '/shopping_flow.php');
15 require_once(ROOT_PATH . 'languages/' .$_CFG['lang']. '/user.php');
16
17 /*------------------------------------------------------ */
18 //-- INPUT
19 /*------------------------------------------------------ */
20
21 if ($_SESSION['user_id'] > 0)
22 {
23     $consignee_list = get_consignee_list($_SESSION['user_id']);
24
25     $choose['country'] = isset($_POST['country']) ? intval($_POST['country']) : $consignee_list[0]['country'];
26     $choose['province'] = isset($_POST['province']) ? intval($_POST['province']) : $consignee_list[0]['province'];
27     $choose['city'] = isset($_POST['city']) ? intval($_POST['city']) : $consignee_list[0]['city'];
28     $choose['district'] = isset($_POST['district']) ? intval($_POST['district']) : (isset($consignee_list[0]['district']) ? $consignee_list[0]['district'] : 0 );
29 }
30 else
31 {
32     $choose['country'] = isset($_POST['country']) ? intval($_POST['country']) : $_CFG['shop_country'];
33     $choose['province'] = isset($_POST['province']) ? intval($_POST['province']) : 2;
34     $choose['city'] = isset($_POST['city']) ? intval($_POST['city']) : 35;
35     $choose['district'] = isset($_POST['district']) ? intval($_POST['district']) : 417;
36 }
37
38 /*------------------------------------------------------ */
39 //-- PROCESSOR
40 /*------------------------------------------------------ */
41
42 assign_template();
43 assign_dynamic('myship');
44 $position = assign_ur_here(0, $_LANG['shopping_myship']);
45 $smarty->assign('page_title', $position['title']);    // 页面标题
46 $smarty->assign('ur_here',    $position['ur_here']);  // 当前位置
47
48 $smarty->assign('helps',      get_shop_help());       // 网店帮助
49 $smarty->assign('lang',       $_LANG);
50
51 $smarty->assign('choose',     $choose);
52
53 $province_list[NULL] = get_regions(1, $choose['country']);
54 $city_list[NULL]     = get_regions(2, $choose['province']);
55 $district_list[NULL] = get_regions(3, $choose['city']);
56
57 $smarty->assign('province_list', $province_list);
58 $smarty->assign('city_list',     $city_list);
59 $smarty->assign('district_list', $district_list);
60
61 /* 取得国家列表、商店所在国家、商店所在国家的省列表 */
62 $smarty->assign('country_list',       get_regions());
63
64 /* 取得配送列表 */
65 $region            = array($choose['country'], $choose['province'], $choose['city'], $choose['district']);
66 $shipping_list     = available_shipping_list($region);
67 $cart_weight_price = 0;
68 $insure_disabled   = true;
69 $cod_disabled      = true;
70
71 foreach ($shipping_list AS $key => $val)
72 {
73     $shipping_cfg = unserialize_config($val['configure']);
74     $shipping_fee = shipping_fee($val['shipping_code'], unserialize($val['configure']),
75     $cart_weight_price['weight'], $cart_weight_price['amount']);
76
77     $shipping_list[$key]['format_shipping_fee'] = price_format($shipping_fee, false);
78     $shipping_list[$key]['fee']        = $shipping_fee;
79     $shipping_list[$key]['free_money']          = price_format($shipping_cfg['free_money'], false);
80     $shipping_list[$key]['insure_formated']     = strpos($val['insure'], '%') === false ?
81     price_format($val['insure'], false) : $val['insure'];
82 }
83
84 $smarty->assign('shipping_list',   $shipping_list);
85
86 $smarty->display('myship.dwt');
87
88 ?>