#300 배송비 관련 코드 수정
This commit is contained in:
@ -621,18 +621,17 @@ $pg_anchor = '<ul class="anchor">
|
||||
<tr>
|
||||
<th scope="row"><label for="de_send_cost_case">배송비유형</label></th>
|
||||
<td>
|
||||
<?php echo help("<strong>상한</strong>으로 설정한 경우, 주문총액이 배송비상한가 미만일 경우 배송비를 받습니다.\n<strong>없음</strong>으로 설정한 경우, 배송비상한가 및 배송비를 무시하며 착불의 경우도 없음으로 설정됩니다.\n<strong>개별배송비</strong>로 설정한 경우, 개별 상품의 배송비 설정이 적용됩니다.", 50); ?>
|
||||
<?php echo help("<strong>금액별차등</strong>으로 설정한 경우, 주문총액이 배송비상한가 미만일 경우 배송비를 받습니다.\n<strong>무료배송</strong>으로 설정한 경우, 배송비상한가 및 배송비를 무시하며 착불의 경우도 무료배송으로 설정합니다.\n<strong>상품별로 배송비 설정을 한 경우 상품별 배송비 설정이 우선</strong> 적용됩니다.\n예를 들어 무료배송으로 설정했을 때 특정 상품에 배송비가 설정되어 있으면 주문시 배송비가 부과됩니다.", 50); ?>
|
||||
<select name="de_send_cost_case" id="de_send_cost_case">
|
||||
<option value="상한" <?php echo get_selected($default['de_send_cost_case'], "상한"); ?>>상한</option>
|
||||
<option value="없음" <?php echo get_selected($default['de_send_cost_case'], "없음"); ?>>없음</option>
|
||||
<option value="개별" <?php echo get_selected($default['de_send_cost_case'], "개별"); ?>>개별배송비</option>
|
||||
<option value="차등" <?php echo get_selected($default['de_send_cost_case'], "차등"); ?>>금액별차등</option>
|
||||
<option value="무료" <?php echo get_selected($default['de_send_cost_case'], "무료"); ?>>무료배송</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="de_send_cost_limit">배송비상한가</label></th>
|
||||
<td>
|
||||
<?php echo help("배송비유형이 '상한'일 경우에만 해당되며 배송비상한가를 여러개 두고자 하는 경우는 <b>;</b> 로 구분합니다.\n\n예를 들어 20000원 미만일 경우 4000원, 30000원 미만일 경우 3000원 으로 사용할 경우에는 배송비상한가를 20000;30000 으로 입력하고 배송비를 4000;3000 으로 입력합니다.", 50); ?>
|
||||
<?php echo help("배송비유형이 '금액별차등'일 경우에만 해당되며 배송비상한가를 여러개 두고자 하는 경우는 <b>;</b> 로 구분합니다.\n\n예를 들어 20000원 미만일 경우 4000원, 30000원 미만일 경우 3000원 으로 사용할 경우에는 배송비상한가를 20000;30000 으로 입력하고 배송비를 4000;3000 으로 입력합니다.", 50); ?>
|
||||
<input type="text" name="de_send_cost_limit" value="<?php echo $default['de_send_cost_limit']; ?>" size="40" class="frm_input" id="de_send_cost_limit"> 원
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -847,7 +847,7 @@ $(function(){
|
||||
<section id="anc_sitfrm_sendcost" class="cbox">
|
||||
<h2>배송비</h2>
|
||||
<?php echo $pg_anchor; ?>
|
||||
<p>쇼핑몰설정 > 배송비유형 설정에서 <strong>개별배송비</strong>로 설정해야만 아래 설정이 적용됩니다.</p>
|
||||
<p>쇼핑몰설정 > 배송비유형 설정보다 <strong>개별상품 배송비설정이 우선</strong> 적용됩니다.</p>
|
||||
|
||||
<table class="frm_tbl">
|
||||
<colgroup>
|
||||
@ -861,10 +861,11 @@ $(function(){
|
||||
<td>
|
||||
<?php echo help("배송비 유형을 선택하면 자동으로 항목이 변환됩니다."); ?>
|
||||
<select name="it_sc_type" id="it_sc_type">
|
||||
<option value="0"<?php echo get_selected('0', $it['it_sc_type']); ?>>무료배송</option>
|
||||
<option value="1"<?php echo get_selected('1', $it['it_sc_type']); ?>>조건부 무료배송</option>
|
||||
<option value="2"<?php echo get_selected('2', $it['it_sc_type']); ?>>유료배송</option>
|
||||
<option value="3"<?php echo get_selected('3', $it['it_sc_type']); ?>>수량별 부과</option>
|
||||
<option value="0"<?php echo get_selected('0', $it['it_sc_type']); ?>>쇼핑몰 기본설정 사용</option>
|
||||
<option value="1"<?php echo get_selected('1', $it['it_sc_type']); ?>>무료배송</option>
|
||||
<option value="2"<?php echo get_selected('2', $it['it_sc_type']); ?>>조건부 무료배송</option>
|
||||
<option value="3"<?php echo get_selected('3', $it['it_sc_type']); ?>>유료배송</option>
|
||||
<option value="4"<?php echo get_selected('4', $it['it_sc_type']); ?>>수량별 부과</option>
|
||||
</select>
|
||||
</td>
|
||||
<td rowspan="4" id="sc_grp" class="group_setting">
|
||||
@ -874,7 +875,7 @@ $(function(){
|
||||
<label for="chk_all_it_sendcost">전체적용</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr id="sc_con_method">
|
||||
<th scope="row"><label for="it_sc_method">배송비 결제</label></th>
|
||||
<td>
|
||||
<select name="it_sc_method" id="it_sc_method">
|
||||
@ -884,7 +885,7 @@ $(function(){
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr id="sc_con_basic">
|
||||
<th scope="row"><label for="it_sc_price">기본배송비</label></th>
|
||||
<td>
|
||||
<?php echo help("무료배송 이외의 설정에 적용되는 배송비 금액입니다."); ?>
|
||||
@ -910,31 +911,69 @@ $(function(){
|
||||
<script>
|
||||
$(function() {
|
||||
<?php
|
||||
if($it['it_sc_type'] == 1) {
|
||||
echo '$("#sc_con_minimum").show();'.PHP_EOL;
|
||||
echo '$("#sc_con_qty").hide();'.PHP_EOL;
|
||||
} else if($it['it_sc_type'] == 3) {
|
||||
echo '$("#sc_con_minimum").hide();'.PHP_EOL;
|
||||
echo '$("#sc_con_qty").show();'.PHP_EOL;
|
||||
} else {
|
||||
echo '$("#sc_con_minimum").hide();'.PHP_EOL;
|
||||
echo '$("#sc_con_qty").hide();'.PHP_EOL;
|
||||
switch($it['it_sc_type']) {
|
||||
case 2:
|
||||
echo '$("#sc_con_method").show();'.PHP_EOL;
|
||||
echo '$("#sc_con_basic").show();'.PHP_EOL;
|
||||
echo '$("#sc_con_minimum").show();'.PHP_EOL;
|
||||
echo '$("#sc_con_qty").hide();'.PHP_EOL;
|
||||
echo '$("#sc_grp").attr("rowspan","4");'.PHP_EOL;
|
||||
break;
|
||||
case 3:
|
||||
echo '$("#sc_con_method").show();'.PHP_EOL;
|
||||
echo '$("#sc_con_basic").show();'.PHP_EOL;
|
||||
echo '$("#sc_con_minimum").hide();'.PHP_EOL;
|
||||
echo '$("#sc_con_qty").hide();'.PHP_EOL;
|
||||
echo '$("#sc_grp").attr("rowspan","3");'.PHP_EOL;
|
||||
break;
|
||||
case 4:
|
||||
echo '$("#sc_con_method").show();'.PHP_EOL;
|
||||
echo '$("#sc_con_basic").show();'.PHP_EOL;
|
||||
echo '$("#sc_con_minimum").hide();'.PHP_EOL;
|
||||
echo '$("#sc_con_qty").show();'.PHP_EOL;
|
||||
echo '$("#sc_grp").attr("rowspan","4");'.PHP_EOL;
|
||||
break;
|
||||
default:
|
||||
echo '$("#sc_con_method").hide();'.PHP_EOL;
|
||||
echo '$("#sc_con_basic").hide();'.PHP_EOL;
|
||||
echo '$("#sc_con_minimum").hide();'.PHP_EOL;
|
||||
echo '$("#sc_con_qty").hide();'.PHP_EOL;
|
||||
echo '$("#sc_grp").attr("rowspan","1");'.PHP_EOL;
|
||||
break;
|
||||
}
|
||||
?>
|
||||
$("#it_sc_type").change(function() {
|
||||
var type = $(this).val();
|
||||
if(type == "1") {
|
||||
$("#sc_con_minimum").show();
|
||||
$("#sc_con_qty").hide();
|
||||
$("#sc_grp").attr('rowspan','4');
|
||||
} else if(type == "3") {
|
||||
$("#sc_con_minimum").hide();
|
||||
$("#sc_con_qty").show();
|
||||
$("#sc_grp").attr('rowspan','4');
|
||||
} else {
|
||||
$("#sc_con_minimum").hide();
|
||||
$("#sc_con_qty").hide();
|
||||
$("#sc_grp").attr('rowspan','3');
|
||||
|
||||
switch(type) {
|
||||
case "2":
|
||||
$("#sc_con_method").show();
|
||||
$("#sc_con_basic").show();
|
||||
$("#sc_con_minimum").show();
|
||||
$("#sc_con_qty").hide();
|
||||
$("#sc_grp").attr("rowspan","4");
|
||||
break;
|
||||
case "3":
|
||||
$("#sc_con_method").show();
|
||||
$("#sc_con_basic").show();
|
||||
$("#sc_con_minimum").hide();
|
||||
$("#sc_con_qty").hide();
|
||||
$("#sc_grp").attr("rowspan","3");
|
||||
break;
|
||||
case "4":
|
||||
$("#sc_con_method").show();
|
||||
$("#sc_con_basic").show();
|
||||
$("#sc_con_minimum").hide();
|
||||
$("#sc_con_qty").show();
|
||||
$("#sc_grp").attr("rowspan","4");
|
||||
break;
|
||||
default:
|
||||
$("#sc_con_method").hide();
|
||||
$("#sc_con_basic").hide();
|
||||
$("#sc_con_minimum").hide();
|
||||
$("#sc_con_qty").hide();
|
||||
$("#sc_grp").attr("rowspan","1");
|
||||
break;
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -1412,18 +1451,18 @@ function fitemformcheck(f)
|
||||
}
|
||||
}
|
||||
|
||||
if(f.it_sc_type.value != "0") {
|
||||
if(parseInt(f.it_sc_type.value) > 1) {
|
||||
if(!f.it_sc_price.value || f.it_sc_price.value == "0") {
|
||||
alert("기본배송비를 입력해 주십시오.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(f.it_sc_type.value == "1" && (!f.it_sc_minimum.value || f.it_sc_minimum.value == "0")) {
|
||||
if(f.it_sc_type.value == "2" && (!f.it_sc_minimum.value || f.it_sc_minimum.value == "0")) {
|
||||
alert("배송비 상세조건의 주문금액을 입력해 주십시오.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(f.it_sc_type.value == "3" && (!f.it_sc_qty.value || f.it_sc_qty.value == "0")) {
|
||||
if(f.it_sc_type.value == "4" && (!f.it_sc_qty.value || f.it_sc_qty.value == "0")) {
|
||||
alert("배송비 상세조건의 주문수량을 입력해 주십시오.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -175,7 +175,7 @@ $cart_coupon = $sum['coupon'];
|
||||
$cart_count = $sum['cnt'];
|
||||
|
||||
// 배송비
|
||||
$send_cost = get_sendcost($cart_price, $od_id);
|
||||
$send_cost = get_sendcost($od_id);
|
||||
|
||||
$tot_od_cp_price = $tot_sc_cp_price = 0;
|
||||
|
||||
|
||||
@ -272,7 +272,7 @@ if($g5_shop_install) {
|
||||
de_point_days = '7',
|
||||
de_card_pg = 'kcp',
|
||||
de_kcp_mid = '',
|
||||
de_send_cost_case = '상한',
|
||||
de_send_cost_case = '차등',
|
||||
de_send_cost_limit = '20000;30000;40000',
|
||||
de_send_cost_list = '4000;3000;2000',
|
||||
de_hope_date_use = '0',
|
||||
|
||||
@ -1476,48 +1476,56 @@ function get_item_point($it)
|
||||
}
|
||||
|
||||
// 배송비 구함
|
||||
function get_sendcost($price, $cart_id, $selected=1)
|
||||
function get_sendcost($cart_id, $selected=1)
|
||||
{
|
||||
global $default, $g5;
|
||||
|
||||
if ($default['de_send_cost_case'] == '없음') {
|
||||
$send_cost = 0;
|
||||
} else if($default['de_send_cost_case'] == '상한') {
|
||||
// 배송비 상한 : 여러단계의 배송비 적용 가능
|
||||
$send_cost = 0;
|
||||
$total_price = 0;
|
||||
$total_send_cost = 0;
|
||||
|
||||
$sql = " select distinct it_id
|
||||
from {$g5['g5_shop_cart_table']}
|
||||
where od_id = '$cart_id'
|
||||
and ct_send_cost = '0'
|
||||
and ct_status IN ( '쇼핑', '주문', '준비', '배송', '완료' )
|
||||
and ct_select = '$selected' ";
|
||||
|
||||
$result = sql_query($sql);
|
||||
for($i=0; $sc=sql_fetch_array($result); $i++) {
|
||||
// 합계
|
||||
$sql = " select SUM(IF(io_type = 1, (io_price * ct_qty), ((ct_price + io_price) * ct_qty))) as price,
|
||||
SUM(ct_qty) as qty
|
||||
from {$g5['g5_shop_cart_table']}
|
||||
where it_id = '{$sc['it_id']}'
|
||||
and od_id = '$cart_id' ";
|
||||
$sum = sql_fetch($sql);
|
||||
|
||||
$send_cost = get_item_sendcost($sc['it_id'], $sum['price'], $sum['qty']);
|
||||
|
||||
if($send_cost > 0)
|
||||
$total_send_cost += $send_cost;
|
||||
|
||||
if($default['de_send_cost_case'] == '차등' && $send_cost == -1)
|
||||
$total_price += $sum['price'];
|
||||
}
|
||||
|
||||
$send_cost = 0;
|
||||
if($default['de_send_cost_case'] == '차등' && $total_price > 0) {
|
||||
// 금액별차등 : 여러단계의 배송비 적용 가능
|
||||
$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 ($price < preg_replace('/[^0-9]/', '', $send_cost_limit[$k])) {
|
||||
if ($total_price < preg_replace('/[^0-9]/', '', $send_cost_limit[$k])) {
|
||||
$send_cost = preg_replace('/[^0-9]/', '', $send_cost_list[$k]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else { // 개별배송비
|
||||
$send_cost = 0;
|
||||
$sql = " select distinct it_id
|
||||
from {$g5['g5_shop_cart_table']}
|
||||
where od_id = '$cart_id'
|
||||
and ct_send_cost = '0'
|
||||
and ct_status IN ( '쇼핑', '주문', '준비', '배송', '완료' )
|
||||
and ct_select = '$selected' ";
|
||||
|
||||
$result = sql_query($sql);
|
||||
for($i=0; $sc=sql_fetch_array($result); $i++) {
|
||||
// 합계
|
||||
$sql = " select SUM(IF(io_type = 1, (io_price * ct_qty), ((ct_price + io_price) * ct_qty))) as price,
|
||||
SUM(ct_qty) as qty
|
||||
from {$g5['g5_shop_cart_table']}
|
||||
where it_id = '{$sc['it_id']}'
|
||||
and od_id = '$cart_id' ";
|
||||
$sum = sql_fetch($sql);
|
||||
|
||||
$send_cost += get_item_sendcost($sc['it_id'], $sum['price'], $sum['qty']);
|
||||
}
|
||||
}
|
||||
|
||||
return $send_cost;
|
||||
return ($total_send_cost + $send_cost);
|
||||
}
|
||||
|
||||
// 상품별 배송비
|
||||
@ -1525,9 +1533,6 @@ function get_item_sendcost($it_id, $price, $qty)
|
||||
{
|
||||
global $g5, $default;
|
||||
|
||||
if($default['de_send_cost_case'] != '개별')
|
||||
return 0;
|
||||
|
||||
$sql = " select it_id, it_sc_type, it_sc_method, it_sc_price, it_sc_minimum, it_sc_qty
|
||||
from {$g5['g5_shop_item_table']}
|
||||
where it_id = '$it_id' ";
|
||||
@ -1535,13 +1540,13 @@ function get_item_sendcost($it_id, $price, $qty)
|
||||
if(!$it['it_id'])
|
||||
return 0;
|
||||
|
||||
if($it['it_sc_type']) {
|
||||
if($it['it_sc_type'] == 1) { // 조건부무료
|
||||
if($it['it_sc_type'] > 1) {
|
||||
if($it['it_sc_type'] == 2) { // 조건부무료
|
||||
if($price >= $it['it_sc_minimum'])
|
||||
$sendcost = 0;
|
||||
else
|
||||
$sendcost = $it['it_sc_price'];
|
||||
} else if($it['it_sc_type'] == 2) { // 유료배송
|
||||
} else if($it['it_sc_type'] == 3) { // 유료배송
|
||||
$sendcost = $it['it_sc_price'];
|
||||
} else { // 수량별 부과
|
||||
if(!$it['it_sc_qty'])
|
||||
@ -1550,8 +1555,10 @@ function get_item_sendcost($it_id, $price, $qty)
|
||||
$q = ceil((int)$qty / (int)$it['it_sc_qty']);
|
||||
$sendcost = (int)$it['it_sc_price'] * $q;
|
||||
}
|
||||
} else {
|
||||
} else if($it['it_sc_type'] == 1) { // 무료배송
|
||||
$sendcost = 0;
|
||||
} else {
|
||||
$sendcost = -1;
|
||||
}
|
||||
|
||||
return $sendcost;
|
||||
|
||||
@ -103,7 +103,7 @@ include_once(G5_MSHOP_PATH.'/_head.php');
|
||||
echo '<tr><td colspan="7" class="empty_table">장바구니에 담긴 상품이 없습니다.</td></tr>';
|
||||
} else {
|
||||
// 배송비 계산
|
||||
$send_cost = get_sendcost($tot_sell_price, $s_cart_id, 0);
|
||||
$send_cost = get_sendcost($s_cart_id, 0);
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
@ -205,7 +205,7 @@ ob_start();
|
||||
alert('장바구니가 비어 있습니다.', G5_SHOP_URL.'/cart.php');
|
||||
} else {
|
||||
// 배송비 계산
|
||||
$send_cost = get_sendcost($tot_sell_price, $s_cart_id);
|
||||
$send_cost = get_sendcost($s_cart_id);
|
||||
}
|
||||
|
||||
// 복합과세처리
|
||||
|
||||
@ -187,7 +187,7 @@ if ((int)($row['od_price'] - $tot_cp_price) !== $i_price) {
|
||||
}
|
||||
|
||||
// 배송비가 상이함
|
||||
$send_cost = get_sendcost($row['od_price'], $tmp_cart_id);
|
||||
$send_cost = get_sendcost($tmp_cart_id);
|
||||
|
||||
$tot_sc_cp_price = 0;
|
||||
if($is_member && $send_cost > 0) {
|
||||
|
||||
@ -126,7 +126,7 @@ include_once('./_head.php');
|
||||
echo '<tr><td colspan="7" class="empty_table">장바구니에 담긴 상품이 없습니다.</td></tr>';
|
||||
} else {
|
||||
// 배송비 계산
|
||||
$send_cost = get_sendcost($tot_sell_price, $s_cart_id, 0);
|
||||
$send_cost = get_sendcost($s_cart_id, 0);
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
@ -197,6 +197,10 @@ else // 장바구니에 담기
|
||||
continue;
|
||||
}
|
||||
|
||||
// 배송비결제
|
||||
if($it['it_sc_type'] > 1 && $it['it_sc_method'] == 1)
|
||||
$ct_send_cost = 1;
|
||||
|
||||
$sql .= $comma."( '$tmp_cart_id', '{$member['mb_id']}', '{$it['it_id']}', '{$it['it_name']}', '쇼핑', '{$it['it_price']}', '$point', '0', '0', '$io_value', '$ct_qty', '{$it['it_notax']}', '$io_id', '$io_type', '$io_price', '".G5_TIME_YMDHIS."', '$REMOTE_ADDR', '$ct_send_cost', '$sw_direct', '$ct_select' )";
|
||||
$comma = ' , ';
|
||||
$ct_count++;
|
||||
|
||||
@ -293,7 +293,7 @@ function get_intall_file()
|
||||
alert('장바구니가 비어 있습니다.', G5_SHOP_URL.'/cart.php');
|
||||
} else {
|
||||
// 배송비 계산
|
||||
$send_cost = get_sendcost($tot_sell_price, $s_cart_id);
|
||||
$send_cost = get_sendcost($s_cart_id);
|
||||
}
|
||||
|
||||
// 복합과세처리
|
||||
|
||||
@ -182,7 +182,7 @@ if ((int)($row['od_price'] - $tot_cp_price) !== $i_price) {
|
||||
}
|
||||
|
||||
// 배송비가 상이함
|
||||
$send_cost = get_sendcost($row['od_price'], $tmp_cart_id);
|
||||
$send_cost = get_sendcost($tmp_cart_id);
|
||||
|
||||
$tot_sc_cp_price = 0;
|
||||
if($is_member && $send_cost > 0) {
|
||||
|
||||
@ -209,23 +209,31 @@ $sns_share_links .= get_sns_share_link('googleplus', $sns_url, $sns_title, G5_SH
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php if($default['de_send_cost_case'] == '개별' && $it['it_sc_type'] != 0) { ?>
|
||||
<?php
|
||||
if($default['de_send_cost_case'] == '무료')
|
||||
$sc_method = '무료배송';
|
||||
else
|
||||
$sc_method = '주문시 결제';
|
||||
|
||||
if($it['it_sc_type'] == 1)
|
||||
$sc_method = '무료배송';
|
||||
else if($it['it_sc_type'] > 1) {
|
||||
if($it['it_sc_method'] == 1)
|
||||
$sc_method = '수령후 지불';
|
||||
else if($it['it_sc_method'] == 2) {
|
||||
$sc_method = '<select name="ct_send_cost" id="ct_send_cost">
|
||||
<option value="0">주문시 결제</option>
|
||||
<option value="1">수령후 지불</option>
|
||||
</select>';
|
||||
}
|
||||
else
|
||||
$sc_method = '주문시 결제';
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<th><label for="ct_send_cost">배송비결제</label></th>
|
||||
<td>
|
||||
<?php
|
||||
if($it['it_sc_method'] == 2) {
|
||||
?>
|
||||
<select name="ct_send_cost" id="ct_send_cost">
|
||||
<option value="0">주문시 결제</option>
|
||||
<option value="1">수령후 지불</option>
|
||||
</select>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td><?php echo $sc_method; ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user