포인트지급 기준금액 및 추가옵션 지급 포인트 설정 추가

This commit is contained in:
chicpro
2014-03-11 15:53:55 +09:00
parent 35318b54bf
commit d36a5a3fc1
12 changed files with 81 additions and 34 deletions

View File

@ -94,6 +94,12 @@ if(!sql_query(" select it_stock_sms from {$g5['g5_shop_item_table']} limit 1 ",
ADD `it_stock_sms` tinyint(4) NOT NULL DEFAULT '0' AFTER `it_stock_qty` ", true);
}
// 추가옵션 포인트 설정 필드 추가
if(!sql_query(" select it_supply_point from {$g5['g5_shop_item_table']} limit 1 ", false)) {
sql_query(" ALTER TABLE `{$g5['g5_shop_item_table']}`
ADD `it_supply_point` int(11) NOT NULL DEFAULT '0' AFTER `it_point_type` ", true);
}
$pg_anchor ='<ul class="anchor">
<li><a href="#anc_sitfrm_cate">상품분류</a></li>
<li><a href="#anc_sitfrm_ini">기본정보</a></li>
@ -483,15 +489,16 @@ $(function(){
<tr>
<th scope="row"><label for="it_point_type">포인트 유형</label></th>
<td>
<?php echo help("포인트 유형을 설정할 수 있습니다. 비율로 설정했을 경우 판매가격의 %비율로 포인트가 지급됩니다."); ?>
<?php echo help("포인트 유형을 설정할 수 있습니다. 비율로 설정했을 경우 설정 기준금액의 %비율로 포인트가 지급됩니다."); ?>
<select name="it_point_type" id="it_point_type">
<option value="0"<?php echo get_selected('0', $it['it_point_type']); ?>>금액</option>
<option value="1"<?php echo get_selected('1', $it['it_point_type']); ?>>비율</option>
<option value="0"<?php echo get_selected('0', $it['it_point_type']); ?>>설정금액</option>
<option value="1"<?php echo get_selected('1', $it['it_point_type']); ?>>판매가기준 설정비율</option>
<option value="2"<?php echo get_selected('2', $it['it_point_type']); ?>>구매가기준 설정비율</option>
</select>
<script>
$(function() {
$("#it_point_type").change(function() {
if($(this).val() == "1")
if(parseInt($(this).val()) > 0)
$("#it_point_unit").text("%");
else
$("#it_point_unit").text("점");
@ -509,7 +516,7 @@ $(function(){
<tr>
<th scope="row"><label for="it_point">포인트</label></th>
<td>
<?php echo help("주문완료후 환경설정에서 설정한 주문완료 설정일 후 회원에게 부여하는 포인트입니다.\n또, 포인트부여를 '아니오'로 설정한 경우 신용카드, 계좌이체로 주문하는 회원께는 부여하지 않습니다.\n게시판의 포인트 기능과는 별개로 동작합니다."); ?>
<?php echo help("주문완료후 환경설정에서 설정한 주문완료 설정일 후 회원에게 부여하는 포인트입니다.\n또, 포인트부여를 '아니오'로 설정한 경우 신용카드, 계좌이체로 주문하는 회원께는 부여하지 않습니다."); ?>
<input type="text" name="it_point" value="<?php echo $it['it_point']; ?>" id="it_point" class="frm_input" size="8"> <span id="it_point_unit"><?php if($it['it_point_type']) echo '%'; else echo '점'; ?></span>
</td>
<td class="td_grpset">
@ -519,6 +526,19 @@ $(function(){
<label for="chk_all_it_point">전체적용</label>
</td>
</tr>
<tr>
<th scope="row"><label for="it_supply_point">추가옵션상품 포인트</label></th>
<td>
<?php echo help("상품의 추가옵션상품 구매에 일괄적으로 지급하는 포인트입니다. 0으로 설정하시면 구매포인트를 지급하지 않습니다.\n주문완료후 환경설정에서 설정한 주문완료 설정일 후 회원에게 부여하는 포인트입니다.\n또, 포인트부여를 '아니오'로 설정한 경우 신용카드, 계좌이체로 주문하는 회원께는 부여하지 않습니다."); ?>
<input type="text" name="it_supply_point" value="<?php echo $it['it_supply_point']; ?>" id="it_supply_point" class="frm_input" size="8"> 점
</td>
<td class="td_grpset">
<input type="checkbox" name="chk_ca_it_supply_point" value="1" id="chk_ca_it_supply_point">
<label for="chk_ca_it_supply_point">분류적용</label>
<input type="checkbox" name="chk_all_it_supply_point" value="1" id="chk_all_it_supply_point">
<label for="chk_all_it_supply_point">전체적용</label>
</td>
</tr>
<tr>
<th scope="row"><label for="it_soldout">상품품절</label></th>
<td>

View File

@ -287,6 +287,7 @@ $sql_common = " ca_id = '$ca_id',
it_price = '$it_price',
it_point = '$it_point',
it_point_type = '$it_point_type',
it_supply_point = '$it_supply_point',
it_notax = '$it_notax',
it_sell_email = '$it_sell_email',
it_use = '$it_use',
@ -473,6 +474,7 @@ if(is_checked('chk_ca_it_price')) $ca_fields .= " , it_price = '$i
if(is_checked('chk_ca_it_cust_price')) $ca_fields .= " , it_cust_price = '$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_supply_point')) $ca_fields .= " , it_supply_point = '$it_supply_point' ";
if(is_checked('chk_ca_it_stock_qty')) $ca_fields .= " , it_stock_qty = '$it_stock_qty' ";
if(is_checked('chk_ca_it_noti_qty')) $ca_fields .= " , it_noti_qty = '$it_noti_qty' ";
if(is_checked('chk_ca_it_sendcost')) $ca_fields .= " , it_sc_type = '$it_sc_type', it_sc_method = '$it_sc_method', it_sc_price = '$it_sc_price', it_sc_minimum = '$it_sc_minimum', it_sc_qty = '$it_sc_qty' ";
@ -521,6 +523,7 @@ if(is_checked('chk_all_it_price')) $all_fields .= " , it_price = '
if(is_checked('chk_all_it_cust_price')) $all_fields .= " , it_cust_price = '$it_cust_price' ";
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_supply_point')) $all_fields .= " , it_supply_point = '$it_supply_point' ";
if(is_checked('chk_all_it_stock_qty')) $all_fields .= " , it_stock_qty = '$it_stock_qty' ";
if(is_checked('chk_all_it_noti_qty')) $all_fields .= " , it_noti_qty = '$it_noti_qty' ";
if(is_checked('chk_all_it_sendcost')) $all_fields .= " , it_sc_type = '$it_sc_type', it_sc_method = '$it_sc_method', it_sc_price = '$it_sc_price', it_sc_minimum = '$it_sc_minimum', it_sc_qty = '$it_sc_qty' ";

View File

@ -384,6 +384,7 @@ CREATE TABLE IF NOT EXISTS `g5_shop_item` (
`it_price` int(11) NOT NULL DEFAULT '0',
`it_point` int(11) NOT NULL DEFAULT '0',
`it_point_type` tinyint(4) NOT NULL DEFAULT '0',
`it_supply_point` int(11) NOT NULL DEFAULT '0',
`it_notax` tinyint(4) NOT NULL DEFAULT '0',
`it_sell_email` varchar(255) NOT NULL DEFAULT '',
`it_use` tinyint(4) NOT NULL DEFAULT '0',

View File

@ -1645,12 +1645,28 @@ function get_order_info($od_id)
// 상품포인트
function get_item_point($it)
function get_item_point($it, $io_id='', $trunc=10)
{
global $g5;
$it_point = 0;
if($it['it_point_type']) {
$it_point = floor(($it['it_price'] * ($it['it_point'] / 100) / 10)) * 10;
if($it['it_point_type'] > 0) {
$it_price = $it['it_price'];
if($it['it_point_type'] == 2 && $io_id) {
$sql = " select io_id, io_price
from {$g5['g5_shop_item_option_table']}
where io_id = '$io_id'
and io_type = '0'
and io_use = '1' ";
$opt = sql_fetch($sql);
if($opt['io_id'])
$it_price += $opt['io_price'];
}
$it_point = floor(($it_price * ($it['it_point'] / 100) / $trunc)) * $trunc;
} else {
$it_point = $it['it_point'];
}

View File

@ -45,7 +45,6 @@ include_once(G5_MSHOP_PATH.'/_head.php');
if ($row['it_tel_inq']) $out_cd = 'tel_inq';
$image = get_it_image($row['it_id'], 50, 50);
$it_point = get_item_point($row);
?>
<tr>

View File

@ -138,9 +138,13 @@ add_stylesheet('<link rel="stylesheet" href="'.G5_MSHOP_SKIN_URL.'/style.css">',
<th scope="row"><label for="disp_point">포인트</label></th>
<td>
<?php
$it_point = get_item_point($it);
echo number_format($it_point);
?> 점
if($it['it_point_type'] == 2) {
echo '구매금액(추가옵션 제외)의 '.$it['it_point'].'%';
} else {
$it_point = get_item_point($it);
echo number_format($it_point).'점';
}
?>
</td>
</tr>
<?php } ?>

View File

@ -141,11 +141,6 @@ else // 장바구니에 담기
$lst_count++;
}
// 포인트
$point = 0;
if($config['cf_use_point'])
$point = get_item_point($it);
//--------------------------------------------------------
// 재고 검사
//--------------------------------------------------------
@ -240,6 +235,19 @@ else // 장바구니에 담기
continue;
}
// 포인트
$point = 0;
if($config['cf_use_point']) {
if($io_type == 0) {
$point = get_item_point($it, $io_id);
} else {
$point = $it['it_supply_point'];
}
if($point < 0)
$point = 0;
}
// 배송비결제
if($it['it_sc_type'] == 1)
$ct_send_cost = 2; // 무료

View File

@ -99,14 +99,7 @@ for ($i=0; $row=sql_fetch_array($result); $i++)
$catename2 = $row2['ca_name'];
}
// 배송비 상한가 미만이면 배송비 적용
$delivery = 0;
if ($row['it_price'] < $cost_limit) {
$delivery = $send_cost;
}
$pdate = date("Ymd", strtotime($row['it_time']));
$point = get_item_point($row);
// 상품이미지
$img_url = get_it_imageurl($row['it_id']);
@ -121,6 +114,7 @@ for ($i=0; $row=sql_fetch_array($result); $i++)
$buy_url = G5_SHOP_URL.'/itembuy.php?it_id='.$row['it_id'];
$it_price = $row['it_price'];
$delivery = get_item_sendcost2($row['it_id'], $it_price, 1);
$point = get_item_point($row);
if($delivery) {
$deliv = 1;
@ -167,6 +161,7 @@ HEREDOC;
$buy_url = G5_SHOP_URL.'/itembuy.php?it_id='.$row['it_id'].'&amp;opt='.$row2['io_id'];
$it_price = $row['it_price'] + $row2['io_price'];
$delivery = get_item_sendcost2($row['it_id'], $it_price, 1);
$point = get_item_point($row, $row2['io_id']);
if($delivery) {
$deliv = $delivery;

View File

@ -76,9 +76,6 @@ for ($i=0; $row=sql_fetch_array($result); $i++)
// 상품이미지
$img_url = get_it_imageurl($row['it_id']);
// 포인트
$it_point = get_item_point($row);
// 상품별옵션
$sql = " select * from {$g5['g5_shop_item_option_table']} where it_id = '{$row['it_id']}' and io_type = '0' and io_use = '1' order by io_no asc ";
$result2 = sql_query($sql);
@ -89,6 +86,7 @@ for ($i=0; $row=sql_fetch_array($result); $i++)
$buy_url = G5_SHOP_URL.'/itembuy.php?it_id='.$row['it_id'];
$it_price = $row['it_price'];
$delivery = get_item_sendcost2($row['it_id'], $it_price, 1);
$it_point = get_item_point($row);
echo <<< HEREDOC
{$lt}begin{$gt}
@ -134,6 +132,7 @@ HEREDOC;
$buy_url = G5_SHOP_URL.'/itembuy.php?it_id='.$row['it_id'].'&amp;opt='.$row2['io_id'];
$it_price = $row['it_price'] + $row2['io_price'];
$delivery = get_item_sendcost2($row['it_id'], $it_price, 1);
$it_point = get_item_point($row, $row2['io_id']);
echo <<< HEREDOC
{$lt}begin{$gt}

View File

@ -77,9 +77,6 @@ for ($i=0; $row=sql_fetch_array($result); $i++)
// 상품이미지
$img_url = get_it_imageurl($row['it_id']);
// 포인트
$it_point = get_item_point($row);
// 상품별옵션
$sql = " select * from {$g5['g5_shop_item_option_table']} where it_id = '{$row['it_id']}' and io_type = '0' and io_use = '1' order by io_no asc ";
$result2 = sql_query($sql);
@ -90,6 +87,7 @@ for ($i=0; $row=sql_fetch_array($result); $i++)
$buy_url = G5_SHOP_URL.'/itembuy.php?it_id='.$row['it_id'];
$it_price = $row['it_price'];
$delivery = get_item_sendcost2($row['it_id'], $it_price, 1);
$it_point = get_item_point($row);
echo <<< HEREDOC
{$lt}begin{$gt}
@ -135,6 +133,7 @@ HEREDOC;
$buy_url = G5_SHOP_URL.'/itembuy.php?it_id='.$row['it_id'].'&amp;opt='.$row2['io_id'];
$it_price = $row['it_price'] + $row2['io_price'];
$delivery = get_item_sendcost2($row['it_id'], $it_price, 1);
$it_point = get_item_point($row, $row2['io_id']);
echo <<< HEREDOC
{$lt}begin{$gt}

View File

@ -50,7 +50,6 @@ include_once('./_head.php');
if ($row['it_tel_inq']) $out_cd = 'tel_inq';
$image = get_it_image($row['it_id'], 70, 70);
$it_point = get_item_point($row);
?>
<tr>

View File

@ -150,9 +150,13 @@ add_stylesheet('<link rel="stylesheet" href="'.G5_SHOP_SKIN_URL.'/style.css">',
<th scope="row">포인트</th>
<td>
<?php
$it_point = get_item_point($it);
echo number_format($it_point);
?> 점
if($it['it_point_type'] == 2) {
echo '구매금액(추가옵션 제외)의 '.$it['it_point'].'%';
} else {
$it_point = get_item_point($it);
echo number_format($it_point).'점';
}
?>
</td>
</tr>
<?php } ?>