#210 개별배송비 기능 추가 중

This commit is contained in:
chicpro
2013-06-12 17:12:47 +09:00
parent 993fe2b396
commit b20f63d9d7
10 changed files with 249 additions and 11 deletions

View File

@ -587,10 +587,11 @@ $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>으로 설정한 경우, 배송비상한가 및 배송비를 무시하며 착불의 경우도 없음으로 설정됩니다.", 50); ?>
<?php echo help("<strong>상한</strong>으로 설정한 경우, 주문총액이 배송비상한가 미만일 경우 배송비를 받습니다.\n<strong>없음</strong>으로 설정한 경우, 배송비상한가 및 배송비를 무시하며 착불의 경우도 없음으로 설정됩니다.\n<strong>개별배송비</strong>로 설정한 경우, 개별 상품의 배송비 설정이 적용됩니다.", 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>
</select>
</td>
</tr>

View File

@ -100,6 +100,7 @@ $pg_anchor ='<ul class="anchor">
<li><a href="#anc_sitfrm_ini">기본정보</a></li>
<li><a href="#anc_sitfrm_compact">요약정보</a></li>
<li><a href="#anc_sitfrm_cost">가격 및 재고</a></li>
<li><a href="#anc_sitfrm_sendcost">배송비</a></li>
<li><a href="#anc_sitfrm_img">상품이미지</a></li>
<li><a href="#anc_sitfrm_relation">관련상품</a></li>
<li><a href="#anc_sitfrm_event">관련이벤트</a></li>
@ -831,6 +832,99 @@ $(function(){
</table>
</section>
<section id="anc_sitfrm_sendcost" class="cbox">
<h2>배송비</h2>
<?php echo $pg_anchor; ?>
<p><?php echo help('쇼핑몰설정 &gt; 배송비유형 설정에서 개별배송으로 설정해야만 아래 설정이 적용됩니다.'); ?></p>
<div>
<table class="frm_tbl">
<colgroup>
<col class="grid_3">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row"><label for="it_sc_type">배송비 유형</label></th>
<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>
</select>
</td>
</tr>
<tr>
<th scope="row"><label for="it_sc_method">배송비 결제</label></th>
<td>
<select name="it_sc_method" id="it_sc_method">
<option value="0"<?php echo get_selected('0', $it['it_sc_method']); ?>>선불</option>
<option value="1"<?php echo get_selected('1', $it['it_sc_method']); ?>>착불</option>
<option value="2"<?php echo get_selected('2', $it['it_sc_method']); ?>>사용자선택</option>
</select>
</td>
</tr>
<tr>
<th scope="row"><label for="it_sc_amount">기본배송비</label></th>
<td>
<?php echo help("무료배송 이외의 설정에 적용되는 배송비 금액입니다."); ?>
<input type="text" name="it_sc_amount" value="<?php echo $it['it_sc_amount']; ?>" id="it_sc_amount" class="frm_input" size="8"> 원
</td>
</tr>
<tr id="sc_con_minimum">
<th scope="row"><label for="it_sc_minimum">배송비 상세조건</label></th>
<td>
주문금액 <input type="text" name="it_sc_minimum" value="<?php echo $it['it_sc_minimum']; ?>" id="it_sc_minimum" class="frm_input" size="8"> 이상 무료 배송
</td>
</tr>
<tr id="sc_con_qty">
<th scope="row"><label for="it_sc_qty">배송비 상세조건</label></th>
<td>
<?php echo help("상품의 주문 수량에 따라 배송비가 부과됩니다. 예를 들어 기본배송비가 3,000원 수량을 3으로 설정했을 경우 상품의 주문수량이 5개이면 6,000원 배송비가 부과됩니다."); ?>
주문수량 <input type="text" name="it_sc_qty" value="<?php echo $it['it_sc_qty']; ?>" id="it_sc_qty" class="frm_input" size="8"> 마다 배송비 부과
</td>
</tr>
</tbody>
</table>
<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").show();'.PHP_EOL;
echo '$("#sc_con_qty").hide();'.PHP_EOL;
} else {
echo '$("#sc_con_minimum").hide();'.PHP_EOL;
echo '$("#sc_con_qty").hide();'.PHP_EOL;
}
?>
$("#it_sc_type").change(function() {
var type = $(this).val();
if(type == "1") {
$("#sc_con_minimum").show();
$("#sc_con_qty").hide();
} else if(type == "3") {
$("#sc_con_minimum").hide();
$("#sc_con_qty").show();
} else {
$("#sc_con_minimum").hide();
$("#sc_con_qty").hide();
}
});
});
</script>
</div>
<div>
<input type="checkbox" name="chk_ca_it_sendcost" value="1" id="chk_ca_it_sendcost">
<label for="chk_ca_it_sendcost">분류적용</label>
<input type="checkbox" name="chk_all_it_sendcost" value="1" id="chk_all_it_sendcost">
<label for="chk_all_it_sendcost">전체적용</label>
</div>
</section>
<section id="anc_sitfrm_img" class="cbox">
<h2>이미지</h2>
<?php echo $pg_anchor; ?>
@ -1363,6 +1457,23 @@ function fitemformcheck(f)
}
}
if(f.it_sc_type.value != "0") {
if(!f.it_sc_amount.value || f.it_sc_amount.value == "0") {
alert("기본배송비를 입력해 주십시오.");
return false;
}
if(f.it_sc_type.value == "1" && (!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")) {
alert("배송비 상세조건의 주문수량을 입력해 주십시오.");
return false;
}
}
<?php echo get_editor_js('it_explan'); ?>
<?php echo get_editor_js('it_mobile_explan'); ?>
<?php echo get_editor_js('it_head_html'); ?>

View File

@ -286,6 +286,11 @@ $sql_common = " ca_id = '$ca_id',
it_sell_email = '$it_sell_email',
it_use = '$it_use',
it_stock_qty = '$it_stock_qty',
it_sc_type = '$it_sc_type',
it_sc_method = '$it_sc_method',
it_sc_amount = '$it_sc_amount',
it_sc_minimum = '$it_sc_minimum',
it_sc_qty = '$it_sc_qty',
it_head_html = '$it_head_html',
it_tail_html = '$it_tail_html',
it_mobile_head_html = '$it_mobile_head_html',
@ -433,6 +438,7 @@ if(is_checked('chk_ca_it_cust_price')) $ca_fields .= " , it_cust_price
if(is_checked('chk_ca_it_point')) $ca_fields .= " , it_point = '$it_point' ";
if(is_checked('chk_ca_it_point_type')) $ca_fields .= " , it_point_type = '$it_point_type' ";
if(is_checked('chk_ca_it_stock_qty')) $ca_fields .= " , it_stock_qty = '$it_stock_qty' ";
if(is_checked('chk_ca_it_sendcost')) $ca_fields .= " , it_sc_type = '$it_sc_type', it_sc_method = '$it_sc_method', it_sc_amount = '$it_sc_amount', it_sc_minimum = '$it_sc_minimum', it_sc_qty = '$it_sc_qty' ";
if(is_checked('chk_ca_it_gallery')) $ca_fields .= " , it_gallery = '$it_gallery' ";
if(is_checked('chk_ca_it_head_html')) $ca_fields .= " , it_head_html = '$it_head_html' ";
if(is_checked('chk_ca_it_tail_html')) $ca_fields .= " , it_tail_html = '$it_tail_html' ";
@ -465,6 +471,7 @@ if(is_checked('chk_all_it_cust_price')) $all_fields .= " , it_cust_pric
if(is_checked('chk_all_it_point')) $all_fields .= " , it_point = '$it_point' ";
if(is_checked('chk_all_it_point_type')) $all_fields .= " , it_point_type = '$it_point_type' ";
if(is_checked('chk_all_it_stock_qty')) $all_fields .= " , it_stock_qty = '$it_stock_qty' ";
if(is_checked('chk_all_it_sendcost')) $all_fields .= " , it_sc_type = '$it_sc_type', it_sc_method = '$it_sc_method', it_sc_amount = '$it_sc_amount', it_sc_minimum = '$it_sc_minimum', it_sc_qty = '$it_sc_qty' ";
if(is_checked('chk_all_it_gallery')) $all_fields .= " , it_gallery = '$it_gallery' ";
if(is_checked('chk_all_it_head_html')) $all_fields .= " , it_head_html = '$it_head_html' ";
if(is_checked('chk_all_it_tail_html')) $all_fields .= " , it_tail_html = '$it_tail_html' ";

View File

@ -282,4 +282,16 @@ if(!$result) {
sql_query(" ALTER TABLE `{$g4['shop_cart_table']}`
ADD `ct_select` TINYINT(4) NOT NULL DEFAULT '0' AFTER `ct_direct` ", true);
}
// 개별배송비 필드 추가
$sql = " select it_sc_type from {$g4['shop_item_table']} limit 1 ";
$result = sql_query($sql, false);
if(!$result) {
sql_query(" ALTER TABLE `{$g4['shop_item_table']}`
ADD `it_sc_type` TINYINT(4) NOT NULL DEFAULT '0' AFTER `it_stock_qty`,
ADD `it_sc_method` TINYINT(4) NOT NULL DEFAULT '0' AFTER `it_sc_type`,
ADD `it_sc_amount` INT(11) NOT NULL DEFAULT '0' AFTER `it_sc_method`,
ADD `it_sc_minimum` INT(11) NOT NULL DEFAULT '0' AFTER `it_sc_amount`,
ADD `it_sc_qty` INT(11) NOT NULL DEFAULT '0' AFTER `it_sc_minimum` ", false);
}
?>

View File

@ -421,6 +421,11 @@ CREATE TABLE IF NOT EXISTS `shop_item` (
`it_sell_email` varchar(255) NOT NULL DEFAULT '',
`it_use` tinyint(4) NOT NULL DEFAULT '0',
`it_stock_qty` int(11) NOT NULL DEFAULT '0',
`it_sc_type` tinyint(4) NOT NULL DEFAULT '0',
`it_sc_method` tinyint(4) NOT NULL DEFAULT '0',
`it_sc_amount` int(11) NOT NULL DEFAULT '0',
`it_sc_minimum` int(11) NOT NULL DEFAULT '0',
`it_sc_qty` int(11) NOT NULL DEFAULT '0',
`it_head_html` text NOT NULL,
`it_tail_html` text NOT NULL,
`it_mobile_head_html` text NOT NULL,

View File

@ -1175,6 +1175,57 @@ function get_item_point($it)
return $it_point;
}
// 상품별 배송비
function get_item_sendcost($it_id, $uq_id)
{
global $g4, $default;
if($default['de_send_cost_case'] != '개별')
return false;
$sql = " select it_id, it_sc_type, it_sc_method, it_sc_amount, it_sc_minimum, it_sc_qty
from {$g4['shop_item_table']}
where it_id = '$it_id' ";
$it = sql_fetch($sql);
if(!$it['it_id'])
return false;
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'])
$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']);
$sendcost = (int)$it['it_sc_amount'] * $q;
}
} else {
$sendcost = 0;
}
return $sendcost;
}
//==============================================================================
// 쇼핑몰 함수 모음 끝
//==============================================================================

View File

@ -341,6 +341,31 @@ else
</td>
</tr>
<?php } ?>
<?php if($default['de_send_cost_case'] == '개별' && $it['it_sc_type'] != 0) { ?>
<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="선불">주문시 결제</option>
<option value="착불">수령후 지불</option>
</select>
<?php
} else {
if($it['it_sc_method']) {
echo '<input type="hidden" name="ct_send_cost" value="착불">';
echo '수령후 지불';
} else {
echo '<input type="hidden" name="ct_send_cost" value="선불">';
echo '주문시 결제';
}
}
?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
@ -391,9 +416,7 @@ else
}
?>
<?php } ?>
<?php } ?>
<?php } // 전화문의가 아닐 경우 끝?>
<div id="sit_sel_option">
<?php if(!$option_1 && !$option_2) { ?>
@ -423,6 +446,8 @@ else
<div id="sit_tot_price"></div>
<?php } // 갤러리가 아닐 경우 끝 ?>
<ul id="sit_ov_btn">
<?php if (!$it['it_tel_inq'] && !$it['it_gallery']) { ?>
<li><a href="javascript:fitemcheck(document.fitem, 'direct_buy');" id="sit_btn_buy">바로구매</a></li>

View File

@ -19,7 +19,7 @@ $sql = " select * from {$g4['shop_cart_table']} where uq_id = '$uq_id' and it_id
$result = sql_query($sql);
// 판매가격
$sql2 = " select ct_price, it_name, ct_point from {$g4['shop_cart_table']} where uq_id = '$uq_id' and it_id = '$it_id' and ct_num = '0' ";
$sql2 = " select ct_price, it_name, ct_send_cost from {$g4['shop_cart_table']} where uq_id = '$uq_id' and it_id = '$it_id' and ct_num = '0' ";
$row2 = sql_fetch($sql2);
if(!mysql_num_rows($result))
@ -32,6 +32,7 @@ if(!mysql_num_rows($result))
<input type="hidden" name="it_price" value="<?php echo $row2['ct_price']; ?>">
<input type="hidden" name="it_name" value="<?php echo $row2['it_name']; ?>">
<input type="hidden" name="it_point" value="<?php echo $it_point; ?>">
<input type="hidden" name="ct_send_cost" value="<?php echo $row2['ct_send_cost']; ?>">
<input type="hidden" name="total_price" value="">
<input type="hidden" name="sw_direct">
<?php

View File

@ -231,11 +231,11 @@ else if ($act == "optionmod") // 장바구니에서 옵션변경
// 장바구니에 Insert
$comma = '';
$sql = " INSERT INTO {$g4['shop_cart_table']}
( uq_id, it_id, it_name, ct_status, ct_price, ct_point, ct_point_use, ct_stock_use, ct_option, ct_qty, ct_num, io_id, io_type, io_price, ct_time, ct_ip, ct_direct )
( uq_id, it_id, it_name, ct_status, ct_price, ct_point, ct_point_use, ct_stock_use, ct_option, ct_qty, ct_num, io_id, io_type, io_price, ct_time, ct_ip, ct_direct, ct_send_cost )
VALUES ";
for($i=0; $i<$option_count; $i++) {
$sql .= $comma."( '$tmp_uq_id', '{$_POST['it_id']}', '{$_POST['it_name']}', '쇼핑', '{$_POST['it_price']}', '{$_POST['it_point']}', '0', '0', '{$_POST['io_value'][$i]}', '{$_POST['ct_qty'][$i]}', '$i', '{$_POST['io_id'][$i]}', '{$_POST['io_type'][$i]}', '{$_POST['io_price'][$i]}', '".G4_TIME_YMDHIS."', '$REMOTE_ADDR', '$sw_direct' )";
$sql .= $comma."( '$tmp_uq_id', '{$_POST['it_id']}', '{$_POST['it_name']}', '쇼핑', '{$_POST['it_price']}', '{$_POST['it_point']}', '0', '0', '{$_POST['io_value'][$i]}', '{$_POST['ct_qty'][$i]}', '$i', '{$_POST['io_id'][$i]}', '{$_POST['io_type'][$i]}', '{$_POST['io_price'][$i]}', '".G4_TIME_YMDHIS."', '$REMOTE_ADDR', '$sw_direct', '$ct_send_cost' )";
$comma = ' , ';
}
@ -355,7 +355,7 @@ else // 장바구니에 담기
$ct_count = 0;
$comma = '';
$sql = " INSERT INTO {$g4['shop_cart_table']}
( uq_id, mb_id, it_id, it_name, ct_status, ct_price, ct_point, ct_point_use, ct_stock_use, ct_option, ct_qty, ct_num, io_id, io_type, io_price, ct_time, ct_ip, ct_direct, ct_select )
( uq_id, mb_id, it_id, it_name, ct_status, ct_price, ct_point, ct_point_use, ct_stock_use, ct_option, ct_qty, ct_num, io_id, io_type, io_price, ct_time, ct_ip, ct_send_cost, ct_direct, ct_select )
VALUES ";
for($i=0; $i<$option_count; $i++) {
@ -376,7 +376,7 @@ else // 장바구니에 담기
continue;
}
$sql .= $comma."( '$tmp_uq_id', '{$member['mb_id']}', '{$_POST['it_id']}', '{$_POST['it_name']}', '쇼핑', '{$_POST['it_price']}', '{$_POST['it_point']}', '0', '0', '{$_POST['io_value'][$i]}', '{$_POST['ct_qty'][$i]}', '$ct_num', '{$_POST['io_id'][$i]}', '{$_POST['io_type'][$i]}', '{$_POST['io_price'][$i]}', '".G4_TIME_YMDHIS."', '$REMOTE_ADDR', '$sw_direct', '$ct_select' )";
$sql .= $comma."( '$tmp_uq_id', '{$member['mb_id']}', '{$_POST['it_id']}', '{$_POST['it_name']}', '쇼핑', '{$_POST['it_price']}', '{$_POST['it_point']}', '0', '0', '{$_POST['io_value'][$i]}', '{$_POST['ct_qty'][$i]}', '$ct_num', '{$_POST['io_id'][$i]}', '{$_POST['io_type'][$i]}', '{$_POST['io_price'][$i]}', '".G4_TIME_YMDHIS."', '$REMOTE_ADDR', '$ct_send_cost', '$sw_direct', '$ct_select' )";
$comma = ' , ';
$ct_num++;
$ct_count++;

View File

@ -345,6 +345,31 @@ else
</td>
</tr>
<?php } ?>
<?php if($default['de_send_cost_case'] == '개별' && $it['it_sc_type'] != 0) { ?>
<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="선불">주문시 결제</option>
<option value="착불">수령후 지불</option>
</select>
<?php
} else {
if($it['it_sc_method']) {
echo '<input type="hidden" name="ct_send_cost" value="착불">';
echo '수령후 지불';
} else {
echo '<input type="hidden" name="ct_send_cost" value="선불">';
echo '주문시 결제';
}
}
?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
@ -397,8 +422,6 @@ else
<?php } // 전화문의가 아닐 경우 끝 ?>
<?php } // 갤러리가 아닐 경우 끝 ?>
<div id="sit_sel_option">
<?php if(!$option_1 && !$option_2) { ?>
<ul id="sit_opt_added">
@ -427,6 +450,8 @@ else
<div id="sit_tot_price"></div>
<?php } // 갤러리가 아닐 경우 끝 ?>
<ul id="sit_ov_btn">
<?php if (!$it['it_tel_inq'] && !$it['it_gallery']) { ?>
<li><a href="javascript:fitemcheck(document.fitem, 'direct_buy');" id="sit_btn_buy">바로구매</a></li>