#210 개별배송비 계산 코드 추가
This commit is contained in:
@ -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 {
|
||||
|
||||
@ -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 .= '<div class="sod_bsk_itopt">'.$it_options.'</div>';
|
||||
}
|
||||
|
||||
// 개별배송비 계산
|
||||
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<count($send_cost_limit); $k++) {
|
||||
// 총판매금액이 배송비 상한가 보다 작다면
|
||||
if ($tot_sell_amount < $send_cost_limit[$k]) {
|
||||
$send_cost = $send_cost_list[$k];
|
||||
if ($tot_sell_amount < preg_replace('/[^0-9]/', '', $send_cost_limit[$k])) {
|
||||
$send_cost = preg_replace('/[^0-9]/', '', $send_cost_list[$k]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$send_cost = $it_send_cost;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@ -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 .= '<div class="sod_bsk_itopt">'.$it_options.'</div>';
|
||||
}
|
||||
|
||||
// 개별배송비 계산
|
||||
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<count($send_cost_limit); $k++) {
|
||||
// 총판매금액이 배송비 상한가 보다 작다면
|
||||
if ($tot_sell_amount < $send_cost_limit[$k]) {
|
||||
$send_cost = $send_cost_list[$k];
|
||||
if ($tot_sell_amount < preg_replace('/[^0-9]/', '', $send_cost_limit[$k])) {
|
||||
$send_cost = preg_replace('/[^0-9]/', '', $send_cost_list[$k]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else { // 개별배송
|
||||
$send_cost = $it_send_cost;
|
||||
}
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php if ($goods_count) $goods .= ' 외 '.$goods_count.'건'; ?>
|
||||
|
||||
<?php
|
||||
// 배송비가 0 보다 크다면 (있다면)
|
||||
if ($send_cost > 0)
|
||||
|
||||
Reference in New Issue
Block a user