From bb013bbdd88cb7af1d6ed318d4446a8e6af249e7 Mon Sep 17 00:00:00 2001 From: chicpro Date: Thu, 13 Jun 2013 10:57:37 +0900 Subject: [PATCH] =?UTF-8?q?#210=20=EA=B0=9C=EB=B3=84=EB=B0=B0=EC=86=A1?= =?UTF-8?q?=EB=B9=84=20=EA=B3=84=EC=82=B0=20=EC=BD=94=EB=93=9C=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/shop.lib.php | 20 +++----------------- mobile/shop/cart.php | 15 +++++++++++---- shop/cart.php | 20 +++++++++++--------- 3 files changed, 25 insertions(+), 30 deletions(-) diff --git a/lib/shop.lib.php b/lib/shop.lib.php index 5fba5214b..ef0a18ede 100644 --- a/lib/shop.lib.php +++ b/lib/shop.lib.php @@ -1177,7 +1177,7 @@ function get_item_point($it) } // 상품별 배송비 -function get_item_sendcost($it_id, $uq_id) +function get_item_sendcost($it_id, $price, $qty) { global $g4, $default; @@ -1193,31 +1193,17 @@ function get_item_sendcost($it_id, $uq_id) if($it['it_sc_type']) { if($it['it_sc_type'] == 1) { // 조건부무료 - $sql = " select SUM( IF(io_type = '1', io_price * ct_qty, (ct_price + io_price) * ct_qty)) as sum_price - from {$g4['shop_cart_table']} - where uq_id = '$uq_id' - and it_id = '$it_id' "; - $ct = sql_fetch($sql); - $item_price = $ct['sum_price']; - - if($item_price >= $it['it_sc_minimum']) + if($price >= $it['it_sc_minimum']) $sendcost = 0; else $sendcost = $it['it_sc_amount']; } else if($it['it_sc_type'] == 2) { // 유료배송 $sendcost = $it['it_sc_amount']; } else { // 수량별 부과 - $sql = " select SUM(ct_qty) as item_count - from {$g4['shop_cart_table']} - where uq_id = '$uq_id' - and it_id = '$it_id' "; - $ct = sql_fetch($sql); - $item_count = $ct['item_count']; - if(!$it['it_sc_qty']) $it['it_sc_qty'] = 1; - $q = ceil((int)$item_count / (int)$it['it_sc_qty']); + $q = ceil((int)$qty / (int)$it['it_sc_qty']); $sendcost = (int)$it['it_sc_amount'] * $q; } } else { diff --git a/mobile/shop/cart.php b/mobile/shop/cart.php index 5424d4d87..f0b77eb1a 100644 --- a/mobile/shop/cart.php +++ b/mobile/shop/cart.php @@ -46,7 +46,7 @@ include_once(G4_MSHOP_PATH.'/_head.php'); $sql .= " order by a.ct_id "; $result = sql_query($sql); - $good_info = ''; + $it_send_cost = 0; for ($i=0; $row=mysql_fetch_array($result); $i++) { @@ -74,6 +74,11 @@ include_once(G4_MSHOP_PATH.'/_head.php'); $it_name .= '
'.$it_options.'
'; } + // 개별배송비 계산 + if($default['de_send_cost_case'] == '개별') { + $it_send_cost += get_item_sendcost($row['it_id'], $sum['price'], $sum['qty']); + } + $point = $sum['point']; $sell_amount = $sum['price']; ?> @@ -104,18 +109,20 @@ include_once(G4_MSHOP_PATH.'/_head.php'); // 배송비 계산 if ($default['de_send_cost_case'] == '없음') $send_cost = 0; - else { + else if($default['de_send_cost_case'] == '상한') { // 배송비 상한 : 여러단계의 배송비 적용 가능 $send_cost_limit = explode(";", $default['de_send_cost_limit']); $send_cost_list = explode(";", $default['de_send_cost_list']); $send_cost = 0; for ($k=0; $k diff --git a/shop/cart.php b/shop/cart.php index 89331029f..dac1e3c64 100644 --- a/shop/cart.php +++ b/shop/cart.php @@ -64,9 +64,6 @@ include_once('./_head.php'); $tot_sell_amount = 0; $tot_cancel_amount = 0; - $goods = $goods_it_id = ""; - $goods_count = -1; - // $s_uq_id 로 현재 장바구니 자료 쿼리 $sql = " select a.ct_id, a.it_id, @@ -88,7 +85,7 @@ include_once('./_head.php'); $sql .= " order by a.ct_id "; $result = sql_query($sql); - $good_info = ''; + $it_send_cost = 0; for ($i=0; $row=mysql_fetch_array($result); $i++) { @@ -116,6 +113,11 @@ include_once('./_head.php'); $it_name .= '
'.$it_options.'
'; } + // 개별배송비 계산 + if($default['de_send_cost_case'] == '개별') { + $it_send_cost += get_item_sendcost($row['it_id'], $sum['price'], $sum['qty']); + } + $point = $sum['point']; $sell_amount = $sum['price']; ?> @@ -153,26 +155,26 @@ include_once('./_head.php'); // 배송비 계산 if ($default['de_send_cost_case'] == '없음') $send_cost = 0; - else { + else if($default['de_send_cost_case'] == '상한') { // 배송비 상한 : 여러단계의 배송비 적용 가능 $send_cost_limit = explode(";", $default['de_send_cost_limit']); $send_cost_list = explode(";", $default['de_send_cost_list']); $send_cost = 0; for ($k=0; $k - - 0)