영카트 [YC5] 상품 일괄 할인 적용하기
페이지 정보
본문
상품 일괄 할인율을 적용하는 방법입니다
지정된 % 가 일괄 할인해서 구매가 이뤄지도록 합니다
1. 파일 구조
그누보드
├ adm
│ ├ shop_admin
│ │ ├ itemsellform.php ( New )
│ │ └ itemsellformupdate.php ( New )
│ ├ eyoom_admin (이윰빌더)
│ │ ├ core
│ │ │ └ shop
│ │ │ ├ itemsellform.php ( New )
│ │ │ └ itemsellformupdate.php ( New )
│ │ └ theme
│ │ └ basic
│ │ └ skin
│ │ └ shop
│ │ └ itemsellform.html.php ( New )
│ └ admin.menu400.shop_1of2.php ( Edit )
├ js
│ └ shop.override_sell_count.js ( New )
├ lib
│ └ naverpay.lib.php ( Edit )
├ mobile
│ └ skin
│ └ shop
│ └ basic
│ ├ list.10.skin.php ( Edit )
│ └ item.form.skin.php ( Edit )
├ shop
│ ├ naverpay
│ │ ├ naver_item.php ( Edit )
│ │ └ naver_order.php ( Edit )
│ └ cartupdate.php ( Edit )
├ skin
│ └ shop
│ └ basic
│ ├ list.10.skin.php ( Edit )
│ └ item.form.skin.php ( Edit )
└ theme
├ basic
│ ├ mobile
│ │ └ skin
│ │ └ shop
│ │ └ basic
│ │ ├ list.10.skin.php ( Edit )
│ │ └ item.form.skin.php ( Edit )
│ └ skin
│ └ shop
│ └ basic
│ ├ list.10.skin.php ( Edit )
│ └ item.form.skin.php ( Edit )
└ eyoom_basic (이윰빌더)
└ skin
└ shop
└ basic
├ list.10.skin.html.php ( Edit )
└ item.form.skin.html.php ( Edit )
2. 디비의 g5_shop_default 에 de_sell_count 필드를 추가
환경설정 > 쇼핑몰 > 일괄할인 메뉴를 클릭하면 자동 생성
3. adm / admin.menu400.shop_1of2.php
array('400100', '쇼핑몰설정', G5_ADMIN_URL.'/shop_admin/configform.php', 'scf_config'),
아래 내용 추가
array('400310', '일괄할인', G5_ADMIN_URL.'/shop_admin/itemsellform.php', 'itemsellform'),
4. adm / shop_admin / itemsellform.php 생성
<?php
$sub_menu = '400310';
include_once('./_common.php');
auth_check($auth[$sub_menu], "w");
$html_title = "일괄할인";
$g5['title'] = $html_title;
include_once (G5_ADMIN_PATH.'/admin.head.php');
// 재입고알림 설정 필드 추가
if(!sql_query(" select de_sell_count from {$g5['g5_shop_default_table']} limit 1 ", false)) {
sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
ADD `de_sell_count` tinyint(4) NOT NULL DEFAULT '0' COMMENT '일괄할인' ", true);
}
?>
<form name="fitemform" action="./itemsellformupdate.php" method="post" enctype="MULTIPART/FORM-DATA" autocomplete="off" onsubmit="return fitemformcheck(this)">
<input type="hidden" name="w" value="<?php echo $w; ?>">
<section id="anc_sitfrm_cate">
<h2 class="h2_frm">일괄할인</h2>
<?php echo $pg_anchor; ?>
<div class="local_desc02 local_desc">
<p>제품 가격을 비율로 일괄 할인 판매합니다</p>
</div>
<div class="tbl_frm01 tbl_wrap">
<table>
<caption>일괄할인</caption>
<colgroup>
<col class="grid_4">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row"><label for="de_sell_count">일괄할인</label></th>
<td>
<?php echo help("할인율이 0 이상일때 할인율이 작동합니다"); ?>
<input type="text" name="de_sell_count" value="<?php echo $default['de_sell_count']; ?>" id="de_sell_count" class="frm_input" size="8"> %
</td>
</tr>
</tbody>
</table>
</div>
</section>
<div class="btn_fixed_top">
<input type="submit" value="확인" class="btn_submit btn" accesskey="s">
</div>
</form>
<script>
var f = document.fitemform;
</script>
<?php
include_once (G5_ADMIN_PATH.'/admin.tail.php');
5. adm / shop_admin / itemsellformupdate.php 생성
<?php
$sub_menu = '400310';
include_once('./_common.php');
check_demo();
auth_check($auth[$sub_menu], "w");
check_admin_token();
$sql = " update {$g5['g5_shop_default_table']}
set de_sell_count = '{$_POST['de_sell_count']}'
";
sql_query($sql);
goto_url("./itemsellform.php");
6. js / shop.override_sell_count.js 생성
jQuery(function($){
$(".2017_renewal_itemform select.it_supply").on("shop_sel_supply_process", function(e, param){
var add_exec = param.add_exec;
var $el = $(this);
var val = $el.val();
//블랙캣77님이 해당 코드에 도움을 주셨습니다.
var eq = $("select.it_supply").index($(this));
var item = $el.closest(".sit_option").find("label").eq(eq).text();
if(!val) {
alert(item+"을(를) 선택해 주십시오.");
return false;
}
var info = val.split(",");
// 재고체크
if(parseInt(info[2]) < 1) {
alert(info[0]+"은(는) 재고가 부족하여 구매할 수 없습니다.");
return false;
}
var id = item+chr(30)+info[0];
var option = item+":"+info[0];
var price = info[1];
var stock = info[2];
// 금액 음수 체크
if(parseInt(price) < 0) {
alert("구매금액이 음수인 상품은 구매할 수 없습니다.");
return false;
}
if(add_exec) {
if(same_option_check(option))
return false;
add_sel_option(1, id, option, price, stock);
}
return false;
});
if (typeof add_sel_option === "function") {
add_sel_option = (function() {
var cached_function = add_sel_option;
return function() {
if( $(".2017_renewal_itemform").length ){
var a = arguments;
var type=a[0],
id=a[1],
option=a[2],
price=a[3],
stock=a[4];
var item_code = $("input[name='it_id[]']").val();
var opt = "";
var li_class = "sit_opt_list";
if(type)
li_class = "sit_spl_list";
var opt_prc;
if(parseInt(price) >= 0)
opt_prc = "+"+number_format(String(price))+"원";
else
opt_prc = number_format(String(price))+"원";
opt += "<li class=\""+li_class+"\">";
opt += "<input type=\"hidden\" name=\"io_type["+item_code+"][]\" value=\""+type+"\">";
opt += "<input type=\"hidden\" name=\"io_id["+item_code+"][]\" value=\""+id+"\">";
opt += "<input type=\"hidden\" name=\"io_value["+item_code+"][]\" value=\""+option+"\">";
opt += "<input type=\"hidden\" class=\"io_price\" value=\""+price+"\">";
opt += "<input type=\"hidden\" class=\"io_stock\" value=\""+stock+"\">";
opt += "<div class=\"opt_name\">";
opt += "<span class=\"sit_opt_subj\">"+option+"</span>";
opt += "</div>";
opt += "<div class=\"opt_count\">";
opt += "<button type=\"button\" class=\"sit_qty_minus\"><i class=\"fa fa-minus\" aria-hidden=\"true\"></i><span class=\"sound_only\">감소</span></button>";
opt += "<input type=\"text\" name=\"ct_qty["+item_code+"][]\" value=\"1\" class=\"num_input\" size=\"5\">";
opt += "<button type=\"button\" class=\"sit_qty_plus\"><i class=\"fa fa-plus\" aria-hidden=\"true\"></i><span class=\"sound_only\">증가</span></button>";
opt += "<span class=\"sit_opt_prc\">"+opt_prc+"</span>";
opt += "<button type=\"button\" class=\"sit_opt_del\"><i class=\"fa fa-times\" aria-hidden=\"true\"></i><span class=\"sound_only\">삭제</span></button></div>";
opt += "</li>";
if($("#sit_sel_option > ul").size() < 1) {
$("#sit_sel_option").html("<ul id=\"sit_opt_added\"></ul>");
$("#sit_sel_option > ul").html(opt);
} else{
if(type) {
if($("#sit_sel_option .sit_spl_list").size() > 0) {
$("#sit_sel_option .sit_spl_list:last").after(opt);
} else {
if($("#sit_sel_option .sit_opt_list").size() > 0) {
$("#sit_sel_option .sit_opt_list:last").after(opt);
} else {
$("#sit_sel_option > ul").html(opt);
}
}
} else {
if($("#sit_sel_option .sit_opt_list").size() > 0) {
$("#sit_sel_option .sit_opt_list:last").after(opt);
} else {
if($("#sit_sel_option .sit_spl_list").size() > 0) {
$("#sit_sel_option .sit_spl_list:first").before(opt);
} else {
$("#sit_sel_option > ul").html(opt);
}
}
}
}
price_calculate();
$("#sit_sel_option").trigger("add_sit_sel_option", [opt]);
} else {
cached_function.apply(this, arguments); // use .apply() to call it
} //end if
};
}());
} //end if check function
});
7. shop / cartupdate.php
$sql .= $comma."( '$tmp_cart_id', '{$member['mb_id']}', '{$it['it_id']}', '".addslashes($it['it_name'])."', '{$it['it_sc_type']}', '{$it['it_sc_method']}', '{$it['it_sc_price']}', '{$it['it_sc_minimum']}', '{$it['it_sc_qty']}', '쇼핑', '{$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', '$ct_select_time' )";
를 아래와 같이 변경
$it_price = $it['it_price']; // 일괄할인 계산을 위해 추가
//if ($default['de_sell_count'] > 0 && ($member['mb_id']=='테스트아이디')) { // 일괄할인 테스트
if ($default['de_sell_count'] > 0) { // 일괄할인 실사용
$io_price = $io_price - (int)($io_price * $default['de_sell_count'] / 100);
$it_price = $it_price - (int)(ceil($it_price * $default['de_sell_count'] / 100));
}
$sql .= $comma."( '{$tmp_cart_id}', '{$member['mb_id']}', '{$it['it_id']}', '".addslashes($it['it_name'])."', '{$it['it_sc_type']}', '{$it['it_sc_method']}', '{$it['it_sc_price']}', '{$it['it_sc_minimum']}', '{$it['it_sc_qty']}', '쇼핑', '{$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}', '{$ct_select_time}' )";
8. / skin / shop / basic / list.10.skin.php
echo display_price(get_price($row), $row['it_tel_inq'])."\n";
를 아래와 같이 변경
// 일괄할인
//if ($default['de_sell_count'] > 0 && ($member['mb_id']=='테스트아이디')) { // 일괄할인 테스트
if ($default['de_sell_count'] > 0) { // 일괄할인 실사용
echo "<strike>".display_price(get_price($row), $row['it_tel_inq'])."</strike>\n";
echo "<span style='font-size:0.8em;'>({$default['de_sell_count']}% 할인)</span><br> ";
echo display_price(get_price($row) - (int)(get_price($row) * $default['de_sell_count'] / 100));
} else {
echo display_price(get_price($row), $row['it_tel_inq'])."\n";
}
9-1. / skin / shop / basic / item.form.skin.php
<tr class="tr_price">
<th scope="row">판매가격</th>
<td>
<strong><?php echo display_price(get_price($it)); ?></strong>
<input type="hidden" id="it_price" value="<?php echo get_price($it); ?>">
</td>
</tr>
를 아래와 같이 변경
<tr class="tr_price">
<th scope="row">판매가격</th>
<td>
<?php
//if ($default['de_sell_count'] > 0 && ($member['mb_id']=='테스트아이디')) { // 일괄할인 테스트
if ($default['de_sell_count'] > 0) { // 일괄할인 실사용
?>
<br>
<strong><strike><?php echo display_price(get_price($it)); ?></strike></strong> <?php echo $default['de_sell_count']; ?>% 할인<br>
<strong><?php echo display_price(get_price($it) - (int)(get_price($it) * $default['de_sell_count'] / 100)); ?></strong>
<input type="hidden" id="it_price" value="<?php echo get_price($it) - (int)(get_price($it) * $default['de_sell_count'] / 100); ?>">
<?php
} else {
?>
<strong><?php echo display_price(get_price($it)); ?></strong>
<input type="hidden" id="it_price" value="<?php echo get_price($it); ?>">
<?php
}
?>
</td>
</tr>
9-2. / skin / shop / basic / item.form.skin.php
<script src="<?php echo G5_JS_URL; ?>/shop.override.js"></script>
를 아래와 같이 변경
<?php
// 일괄할인
if ($default['de_sell_count'] > 0) { // 일괄할인 실사용
?>
<script src="<?php echo G5_JS_URL; ?>/shop.override_sell_count.js?ver=<?php //echo time(); ?>"></script>
<script>
if (typeof price_calculate === "function") {
price_calculate = (function() {
var cached_function = price_calculate;
return function() {
if( $(".2017_renewal_itemform").length ){
var it_price = parseInt($("input#it_price").val());
if(isNaN(it_price))
return;
var $el_prc = $("input.io_price");
var $el_qty = $("input[name^=ct_qty]");
var $el_type = $("input[name^=io_type]");
var price, type, qty, total = 0;
$el_prc.each(function(index) {
price = parseInt($(this).val());
qty = parseInt($el_qty.eq(index).val());
type = $el_type.eq(index).val();
if(type == "0") { // 선택옵션
total += (it_price + price - parseInt(price * <?php echo $default['de_sell_count']; ?> / 100)) * qty;
} else { // 추가옵션
total += (price - parseInt(price * <?php echo $default['de_sell_count']; ?> / 100)) * qty;
}
});
$("#sit_tot_price").empty().html("<span>총 금액. </span><strong>"+number_format(String(total))+"</strong> 원");
$("#sit_tot_price").trigger("price_calculate", [total]);
} else {
cached_function.apply(this, arguments); // use .apply() to call it
}
};
}());
} //end if check function
</script>
<?php
} else {
?>
<script src="<?php echo G5_JS_URL; ?>/shop.override.js"></script>
<?php
}
?>
10-1. lib / naverpay.lib.php
$uprice = get_price($it);
foreach($opts as $opt) {
if($opt['type'])
$price += ((int)$opt['price'] * (int)$opt['qty']);
를 아래와 같이 변경
$uprice = get_price($it);
// 일괄할인 (1/2)
//if ($default['de_sell_count'] > 0 && ($member['mb_id']=='테스트아이디')) { // 일괄할인 테스트
if ($default['de_sell_count'] > 0) { // 일괄할인 실사용
$uprice = (int)($uprice - $uprice * $default['de_sell_count'] / 100);
}
foreach($opts as $opt) {
//if($opt['type'])
// $price += ((int)$opt['price'] * (int)$opt['qty']);
if($opt['type']) {
// 일괄할인
if ($default['de_sell_count'] > 0) { // 일괄할인 실사용
$price += (((int)$opt['price'] - (int)($opt['price'] * $default['de_sell_count'] / 100)) * (int)$opt['qty']);
} else {
$price += ((int)$opt['price'] * (int)$opt['qty']);
}
}
10-2. lib / naverpay.lib.php
$uprice = get_price($it);
$tprice = 0;
foreach($opts as $opt) {
if($opt['type'])
$tprice = ((int)$opt['price'] * (int)$opt['qty']);
else
$tprice = (((int)$uprice + (int)$opt['price']) * (int)$opt['qty']);
를 아래와 같이 변경
$uprice = get_price($it);
// 일괄할인 (2/2)
//if ($default['de_sell_count'] > 0 && ($member['mb_id']=='테스트아이디')) { // 일괄할인 테스트
if ($default['de_sell_count'] > 0) { // 일괄할인 실사용
$uprice = $uprice - (int)($uprice * $default['de_sell_count'] / 100);
}
$tprice = 0;
foreach($opts as $opt) {
//if($opt['type'])
// $tprice = ((int)$opt['price'] * (int)$opt['qty']);
//else
// $tprice = (((int)$uprice + (int)$opt['price']) * (int)$opt['qty']);
if($opt['type']) {
// 일괄할인
if ($default['de_sell_count'] > 0) { // 일괄할인 실사용
$tprice = (((int)($opt['price'] - (int)($opt['price'] * $default['de_sell_count'] / 100))) * (int)$opt['qty']);
} else {
$tprice = ((int)$opt['price'] * (int)$opt['qty']);
}
} else {
//$tprice = (((int)$uprice + (int)$opt['price']) * (int)$opt['qty']);
// 일괄할인
if ($default['de_sell_count'] > 0) { // 일괄할인 실사용
$tprice = (((int)$uprice + (int)($opt['price'] - (int)($opt['price'] * $default['de_sell_count'] / 100))) * (int)$opt['qty']);
} else {
$tprice = (((int)$uprice + (int)$opt['price']) * (int)$opt['qty']);
}
}
11. shop / naverpay / naver_item.php
$price = get_price($it);
아래에 내용 추가
// 일괄할인
//if ($default['de_sell_count'] > 0 && ($member['mb_id']=='테스트아이디')) { // 일괄할인 테스트
if ($default['de_sell_count'] > 0) { // 일괄할인 실사용
$price = $price - (int)($price * $default['de_sell_count'] / 100);
}
12. shop / naverpay / naver_order.php
$it_price = get_price($it);
아래에 내용 추가
// 일괄할인
//if ($default['de_sell_count'] > 0 && ($member['mb_id']=='테스트아이디')) { // 일괄할인 테스트
if ($default['de_sell_count'] > 0) { // 일괄할인 실사용실사용
$io_price = $io_price - (int)($io_price * $default['de_sell_count'] / 100);
$it_price = get_price($it) - (int)(get_price($it) * $default['de_sell_count'] / 100);
}
이윰빌더 사용시 작업
1. adm / eyoom_admin / core / basic / skin/ shop / itemsellform.php 생성
<?php
if (!defined('_EYOOM_IS_ADMIN_')) exit;
$sub_menu = '400310';
include_once('./_common.php');
auth_check($auth[$sub_menu], "w");
$action_url1 = G5_ADMIN_URL . '/?dir=shop&pid=itemsellformupdate&smode=1';
// 재입고알림 설정 필드 추가
if(!sql_query(" select de_sell_count from {$g5['g5_shop_default_table']} limit 1 ", false)) {
sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
ADD `de_sell_count` tinyint(4) NOT NULL DEFAULT '0' COMMENT '일괄할인' ", true);
}
2. adm / eyoom_admin / core / basic / skin/ shop / itemsellformupdate.php 생성
<?php
if (!defined('_EYOOM_IS_ADMIN_')) exit;
$sub_menu = '400310';
include_once('./_common.php');
check_demo();
auth_check($auth[$sub_menu], "w");
check_admin_token();
$sql = " update {$g5['g5_shop_default_table']}
set de_sell_count = '{$_POST['de_sell_count']}'
";
sql_query($sql);
//goto_url("./itemsellform.php");
alert("적용하였습니다.", G5_ADMIN_URL . "/?dir=shop&pid=itemsellform");
3. adm / eyoom_admin / theme / basic / skin/ shop / itemsellform.html.php 생성
<?php
if (!defined('_EYOOM_IS_ADMIN_')) exit;
add_stylesheet('<link rel="stylesheet" href="'.EYOOM_ADMIN_THEME_URL.'/plugins/jsgrid/jsgrid.min.css" type="text/css" media="screen">',0);
add_stylesheet('<link rel="stylesheet" href="'.EYOOM_ADMIN_THEME_URL.'/plugins/jsgrid/jsgrid-theme.min.css" type="text/css" media="screen">',0);
?>
<form name="fitemform" action="<?php echo $action_url1; ?>" method="post" enctype="MULTIPART/FORM-DATA" autocomplete="off" onsubmit="return fitemformcheck(this)">
<input type="hidden" name="w" value="<?php echo $w; ?>">
<section id="anc_sitfrm_cate">
<h2 class="h2_frm">일괄할인</h2>
<?php echo $pg_anchor; ?>
<div class="local_desc02 local_desc">
<p>제품 가격을 비율로 일괄 할인 판매합니다</p>
</div>
<div class="tbl_frm01 tbl_wrap">
<table>
<caption>일괄할인</caption>
<colgroup>
<col class="grid_4">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row"><label for="de_sell_count">일괄할인</label></th>
<td>
<?php echo help("할인율이 0 이상일때 할인율이 작동합니다"); ?>
<input type="text" name="de_sell_count" value="<?php echo $default['de_sell_count']; ?>" id="de_sell_count" class="frm_input" size="8"> %
</td>
</tr>
</tbody>
</table>
</div>
</section>
<div class="btn_fixed_top">
<input type="submit" value="확인" class="btn_submit btn" accesskey="s">
</div>
</form>
<script>
var f = document.fitemform;
</script>
4. theme / eyoom_basic / skin / shop / basic / list10.skin.html.php
<?php if ($this->view_it_price) { ?>
<span class="title-price">₩ <?php echo $list[$i]['it_tel_inq']; ?></span>
<?php } ?>
<?php if ($this->view_it_cust_price && $list[$i]['it_cust_price']) { ?>
<span class="title-price line-through">₩ <?php echo $list[$i]['it_cust_price']; ?></span>
<?php } ?>
를 아래와 같이 변경
<?php
// 일괄할인
//if ($default['de_sell_count'] > 0 && ($member['mb_id']=='테스트아이디')) { // 일괄할인 테스트
if ($default['de_sell_count'] > 0) { // 일괄할인 실사용
?>
<?php if ($this->view_it_price) { ?>
<span class="title-price"><strike>₩ <?php echo $list[$i]['it_tel_inq']; ?></strike></span>
<?php echo " <span style='font-size:0.8em;'>({$default['de_sell_count']}% 할인)</span><br> "; ?>
<span class="title-price">₩ <?php echo number_Format($list[$i]['it_price'] - (int)($list[$i]['it_price'] * $default['de_sell_count'] / 100)); ?></span>
<?php } ?>
<?php if ($this->view_it_cust_price && $list[$i]['it_cust_price']) { ?>
<span class="title-price line-through">₩ <?php echo $list[$i]['it_cust_price']; ?></span>
<?php } ?>
<?php
} else {
?>
<?php if ($this->view_it_price) { ?>
<span class="title-price">₩ <?php echo $list[$i]['it_tel_inq']; ?></span>
<?php } ?>
<?php if ($this->view_it_cust_price && $list[$i]['it_cust_price']) { ?>
<span class="title-price line-through">₩ <?php echo $list[$i]['it_cust_price']; ?></span>
<?php } ?>
<?php
}
?>
5. theme / eyoom_basic / skin / shop / basic / item.form.skin.html.php
<tr>
<th scope="row">판매가격</th>
<td>
<strong class="shop-product-prices"><?php echo display_price(get_price($it)); ?></strong>
<input type="hidden" id="it_price" value="<?php echo get_price($it); ?>">
<?php if ($it['it_cust_price']) { ?>
<span class="line-through"><?php echo display_price($it['it_cust_price']); ?></span>
<?php } ?>
</td>
</tr>
를 아래와 같이 변경
<tr>
<th scope="row">판매가격</th>
<td>
<?php
//if ($default['de_sell_count'] > 0 && ($member['mb_id']=='테스트아이디')) { // 일괄할인 테스트
if ($default['de_sell_count'] > 0) { // 일괄할인 실사용
?>
<br>
<strong><strike><?php echo display_price(get_price($it)); ?></strike></strong> <?php echo $default['de_sell_count']; ?>% 할인<br>
<strong class="shop-product-prices"><?php echo display_price(get_price($it) - (int)(get_price($it) * $default['de_sell_count'] / 100)); ?></strong>
<input type="hidden" id="it_price" value="<?php echo get_price($it) - (int)(get_price($it) * $default['de_sell_count'] / 100); ?>">
<?php if ($it['it_cust_price']) { ?>
<span class="line-through"><?php echo display_price($it['it_cust_price']); ?></span>
<?php } ?>
<?php
} else {
?>
<strong class="shop-product-prices"><?php echo display_price(get_price($it)); ?></strong>
<input type="hidden" id="it_price" value="<?php echo get_price($it); ?>">
<?php if ($it['it_cust_price']) { ?>
<span class="line-through"><?php echo display_price($it['it_cust_price']); ?></span>
<?php } ?>
<?php
}
?>
</td>
</tr>
6. theme / eyoom_basic / skin / shop / basic / item.form.skin.html.php
<script src="<?php echo G5_JS_URL; ?>/shop.override.js"></script>
를 아래와 같이 변경
<?php
// 일괄할인
if ($default['de_sell_count'] > 0) { // 일괄할인 실사용
?>
<script src="<?php echo G5_JS_URL; ?>/shop.override_sell_count.js?ver=<?php //echo time(); ?>"></script>
<script>
if (typeof price_calculate === "function") {
price_calculate = (function() {
var cached_function = price_calculate;
return function() {
if( $(".2017_renewal_itemform").length ){
var it_price = parseInt($("input#it_price").val());
if(isNaN(it_price))
return;
var $el_prc = $("input.io_price");
var $el_qty = $("input[name^=ct_qty]");
var $el_type = $("input[name^=io_type]");
var price, type, qty, total = 0;
$el_prc.each(function(index) {
price = parseInt($(this).val());
qty = parseInt($el_qty.eq(index).val());
type = $el_type.eq(index).val();
if(type == "0") { // 선택옵션
total += (it_price + price - parseInt(price * <?php echo $default['de_sell_count']; ?> / 100)) * qty;
} else { // 추가옵션
total += (price - parseInt(price * <?php echo $default['de_sell_count']; ?> / 100)) * qty;
}
});
$("#sit_tot_price").empty().html("<span>총 금액. </span><strong>"+number_format(String(total))+"</strong> 원");
$("#sit_tot_price").trigger("price_calculate", [total]);
} else {
cached_function.apply(this, arguments); // use .apply() to call it
}
};
}());
} //end if check function
</script>
<?php
} else {
?>
<script src="<?php echo G5_JS_URL; ?>/shop.override.js"></script>
<?php
}
?>
지정된 % 가 일괄 할인해서 구매가 이뤄지도록 합니다
1. 파일 구조
그누보드
├ adm
│ ├ shop_admin
│ │ ├ itemsellform.php ( New )
│ │ └ itemsellformupdate.php ( New )
│ ├ eyoom_admin (이윰빌더)
│ │ ├ core
│ │ │ └ shop
│ │ │ ├ itemsellform.php ( New )
│ │ │ └ itemsellformupdate.php ( New )
│ │ └ theme
│ │ └ basic
│ │ └ skin
│ │ └ shop
│ │ └ itemsellform.html.php ( New )
│ └ admin.menu400.shop_1of2.php ( Edit )
├ js
│ └ shop.override_sell_count.js ( New )
├ lib
│ └ naverpay.lib.php ( Edit )
├ mobile
│ └ skin
│ └ shop
│ └ basic
│ ├ list.10.skin.php ( Edit )
│ └ item.form.skin.php ( Edit )
├ shop
│ ├ naverpay
│ │ ├ naver_item.php ( Edit )
│ │ └ naver_order.php ( Edit )
│ └ cartupdate.php ( Edit )
├ skin
│ └ shop
│ └ basic
│ ├ list.10.skin.php ( Edit )
│ └ item.form.skin.php ( Edit )
└ theme
├ basic
│ ├ mobile
│ │ └ skin
│ │ └ shop
│ │ └ basic
│ │ ├ list.10.skin.php ( Edit )
│ │ └ item.form.skin.php ( Edit )
│ └ skin
│ └ shop
│ └ basic
│ ├ list.10.skin.php ( Edit )
│ └ item.form.skin.php ( Edit )
└ eyoom_basic (이윰빌더)
└ skin
└ shop
└ basic
├ list.10.skin.html.php ( Edit )
└ item.form.skin.html.php ( Edit )
2. 디비의 g5_shop_default 에 de_sell_count 필드를 추가
환경설정 > 쇼핑몰 > 일괄할인 메뉴를 클릭하면 자동 생성
3. adm / admin.menu400.shop_1of2.php
array('400100', '쇼핑몰설정', G5_ADMIN_URL.'/shop_admin/configform.php', 'scf_config'),
아래 내용 추가
array('400310', '일괄할인', G5_ADMIN_URL.'/shop_admin/itemsellform.php', 'itemsellform'),
4. adm / shop_admin / itemsellform.php 생성
<?php
$sub_menu = '400310';
include_once('./_common.php');
auth_check($auth[$sub_menu], "w");
$html_title = "일괄할인";
$g5['title'] = $html_title;
include_once (G5_ADMIN_PATH.'/admin.head.php');
// 재입고알림 설정 필드 추가
if(!sql_query(" select de_sell_count from {$g5['g5_shop_default_table']} limit 1 ", false)) {
sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
ADD `de_sell_count` tinyint(4) NOT NULL DEFAULT '0' COMMENT '일괄할인' ", true);
}
?>
<form name="fitemform" action="./itemsellformupdate.php" method="post" enctype="MULTIPART/FORM-DATA" autocomplete="off" onsubmit="return fitemformcheck(this)">
<input type="hidden" name="w" value="<?php echo $w; ?>">
<section id="anc_sitfrm_cate">
<h2 class="h2_frm">일괄할인</h2>
<?php echo $pg_anchor; ?>
<div class="local_desc02 local_desc">
<p>제품 가격을 비율로 일괄 할인 판매합니다</p>
</div>
<div class="tbl_frm01 tbl_wrap">
<table>
<caption>일괄할인</caption>
<colgroup>
<col class="grid_4">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row"><label for="de_sell_count">일괄할인</label></th>
<td>
<?php echo help("할인율이 0 이상일때 할인율이 작동합니다"); ?>
<input type="text" name="de_sell_count" value="<?php echo $default['de_sell_count']; ?>" id="de_sell_count" class="frm_input" size="8"> %
</td>
</tr>
</tbody>
</table>
</div>
</section>
<div class="btn_fixed_top">
<input type="submit" value="확인" class="btn_submit btn" accesskey="s">
</div>
</form>
<script>
var f = document.fitemform;
</script>
<?php
include_once (G5_ADMIN_PATH.'/admin.tail.php');
5. adm / shop_admin / itemsellformupdate.php 생성
<?php
$sub_menu = '400310';
include_once('./_common.php');
check_demo();
auth_check($auth[$sub_menu], "w");
check_admin_token();
$sql = " update {$g5['g5_shop_default_table']}
set de_sell_count = '{$_POST['de_sell_count']}'
";
sql_query($sql);
goto_url("./itemsellform.php");
6. js / shop.override_sell_count.js 생성
jQuery(function($){
$(".2017_renewal_itemform select.it_supply").on("shop_sel_supply_process", function(e, param){
var add_exec = param.add_exec;
var $el = $(this);
var val = $el.val();
//블랙캣77님이 해당 코드에 도움을 주셨습니다.
var eq = $("select.it_supply").index($(this));
var item = $el.closest(".sit_option").find("label").eq(eq).text();
if(!val) {
alert(item+"을(를) 선택해 주십시오.");
return false;
}
var info = val.split(",");
// 재고체크
if(parseInt(info[2]) < 1) {
alert(info[0]+"은(는) 재고가 부족하여 구매할 수 없습니다.");
return false;
}
var id = item+chr(30)+info[0];
var option = item+":"+info[0];
var price = info[1];
var stock = info[2];
// 금액 음수 체크
if(parseInt(price) < 0) {
alert("구매금액이 음수인 상품은 구매할 수 없습니다.");
return false;
}
if(add_exec) {
if(same_option_check(option))
return false;
add_sel_option(1, id, option, price, stock);
}
return false;
});
if (typeof add_sel_option === "function") {
add_sel_option = (function() {
var cached_function = add_sel_option;
return function() {
if( $(".2017_renewal_itemform").length ){
var a = arguments;
var type=a[0],
id=a[1],
option=a[2],
price=a[3],
stock=a[4];
var item_code = $("input[name='it_id[]']").val();
var opt = "";
var li_class = "sit_opt_list";
if(type)
li_class = "sit_spl_list";
var opt_prc;
if(parseInt(price) >= 0)
opt_prc = "+"+number_format(String(price))+"원";
else
opt_prc = number_format(String(price))+"원";
opt += "<li class=\""+li_class+"\">";
opt += "<input type=\"hidden\" name=\"io_type["+item_code+"][]\" value=\""+type+"\">";
opt += "<input type=\"hidden\" name=\"io_id["+item_code+"][]\" value=\""+id+"\">";
opt += "<input type=\"hidden\" name=\"io_value["+item_code+"][]\" value=\""+option+"\">";
opt += "<input type=\"hidden\" class=\"io_price\" value=\""+price+"\">";
opt += "<input type=\"hidden\" class=\"io_stock\" value=\""+stock+"\">";
opt += "<div class=\"opt_name\">";
opt += "<span class=\"sit_opt_subj\">"+option+"</span>";
opt += "</div>";
opt += "<div class=\"opt_count\">";
opt += "<button type=\"button\" class=\"sit_qty_minus\"><i class=\"fa fa-minus\" aria-hidden=\"true\"></i><span class=\"sound_only\">감소</span></button>";
opt += "<input type=\"text\" name=\"ct_qty["+item_code+"][]\" value=\"1\" class=\"num_input\" size=\"5\">";
opt += "<button type=\"button\" class=\"sit_qty_plus\"><i class=\"fa fa-plus\" aria-hidden=\"true\"></i><span class=\"sound_only\">증가</span></button>";
opt += "<span class=\"sit_opt_prc\">"+opt_prc+"</span>";
opt += "<button type=\"button\" class=\"sit_opt_del\"><i class=\"fa fa-times\" aria-hidden=\"true\"></i><span class=\"sound_only\">삭제</span></button></div>";
opt += "</li>";
if($("#sit_sel_option > ul").size() < 1) {
$("#sit_sel_option").html("<ul id=\"sit_opt_added\"></ul>");
$("#sit_sel_option > ul").html(opt);
} else{
if(type) {
if($("#sit_sel_option .sit_spl_list").size() > 0) {
$("#sit_sel_option .sit_spl_list:last").after(opt);
} else {
if($("#sit_sel_option .sit_opt_list").size() > 0) {
$("#sit_sel_option .sit_opt_list:last").after(opt);
} else {
$("#sit_sel_option > ul").html(opt);
}
}
} else {
if($("#sit_sel_option .sit_opt_list").size() > 0) {
$("#sit_sel_option .sit_opt_list:last").after(opt);
} else {
if($("#sit_sel_option .sit_spl_list").size() > 0) {
$("#sit_sel_option .sit_spl_list:first").before(opt);
} else {
$("#sit_sel_option > ul").html(opt);
}
}
}
}
price_calculate();
$("#sit_sel_option").trigger("add_sit_sel_option", [opt]);
} else {
cached_function.apply(this, arguments); // use .apply() to call it
} //end if
};
}());
} //end if check function
});
7. shop / cartupdate.php
$sql .= $comma."( '$tmp_cart_id', '{$member['mb_id']}', '{$it['it_id']}', '".addslashes($it['it_name'])."', '{$it['it_sc_type']}', '{$it['it_sc_method']}', '{$it['it_sc_price']}', '{$it['it_sc_minimum']}', '{$it['it_sc_qty']}', '쇼핑', '{$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', '$ct_select_time' )";
를 아래와 같이 변경
$it_price = $it['it_price']; // 일괄할인 계산을 위해 추가
//if ($default['de_sell_count'] > 0 && ($member['mb_id']=='테스트아이디')) { // 일괄할인 테스트
if ($default['de_sell_count'] > 0) { // 일괄할인 실사용
$io_price = $io_price - (int)($io_price * $default['de_sell_count'] / 100);
$it_price = $it_price - (int)(ceil($it_price * $default['de_sell_count'] / 100));
}
$sql .= $comma."( '{$tmp_cart_id}', '{$member['mb_id']}', '{$it['it_id']}', '".addslashes($it['it_name'])."', '{$it['it_sc_type']}', '{$it['it_sc_method']}', '{$it['it_sc_price']}', '{$it['it_sc_minimum']}', '{$it['it_sc_qty']}', '쇼핑', '{$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}', '{$ct_select_time}' )";
8. / skin / shop / basic / list.10.skin.php
echo display_price(get_price($row), $row['it_tel_inq'])."\n";
를 아래와 같이 변경
// 일괄할인
//if ($default['de_sell_count'] > 0 && ($member['mb_id']=='테스트아이디')) { // 일괄할인 테스트
if ($default['de_sell_count'] > 0) { // 일괄할인 실사용
echo "<strike>".display_price(get_price($row), $row['it_tel_inq'])."</strike>\n";
echo "<span style='font-size:0.8em;'>({$default['de_sell_count']}% 할인)</span><br> ";
echo display_price(get_price($row) - (int)(get_price($row) * $default['de_sell_count'] / 100));
} else {
echo display_price(get_price($row), $row['it_tel_inq'])."\n";
}
9-1. / skin / shop / basic / item.form.skin.php
<tr class="tr_price">
<th scope="row">판매가격</th>
<td>
<strong><?php echo display_price(get_price($it)); ?></strong>
<input type="hidden" id="it_price" value="<?php echo get_price($it); ?>">
</td>
</tr>
를 아래와 같이 변경
<tr class="tr_price">
<th scope="row">판매가격</th>
<td>
<?php
//if ($default['de_sell_count'] > 0 && ($member['mb_id']=='테스트아이디')) { // 일괄할인 테스트
if ($default['de_sell_count'] > 0) { // 일괄할인 실사용
?>
<br>
<strong><strike><?php echo display_price(get_price($it)); ?></strike></strong> <?php echo $default['de_sell_count']; ?>% 할인<br>
<strong><?php echo display_price(get_price($it) - (int)(get_price($it) * $default['de_sell_count'] / 100)); ?></strong>
<input type="hidden" id="it_price" value="<?php echo get_price($it) - (int)(get_price($it) * $default['de_sell_count'] / 100); ?>">
<?php
} else {
?>
<strong><?php echo display_price(get_price($it)); ?></strong>
<input type="hidden" id="it_price" value="<?php echo get_price($it); ?>">
<?php
}
?>
</td>
</tr>
9-2. / skin / shop / basic / item.form.skin.php
<script src="<?php echo G5_JS_URL; ?>/shop.override.js"></script>
를 아래와 같이 변경
<?php
// 일괄할인
if ($default['de_sell_count'] > 0) { // 일괄할인 실사용
?>
<script src="<?php echo G5_JS_URL; ?>/shop.override_sell_count.js?ver=<?php //echo time(); ?>"></script>
<script>
if (typeof price_calculate === "function") {
price_calculate = (function() {
var cached_function = price_calculate;
return function() {
if( $(".2017_renewal_itemform").length ){
var it_price = parseInt($("input#it_price").val());
if(isNaN(it_price))
return;
var $el_prc = $("input.io_price");
var $el_qty = $("input[name^=ct_qty]");
var $el_type = $("input[name^=io_type]");
var price, type, qty, total = 0;
$el_prc.each(function(index) {
price = parseInt($(this).val());
qty = parseInt($el_qty.eq(index).val());
type = $el_type.eq(index).val();
if(type == "0") { // 선택옵션
total += (it_price + price - parseInt(price * <?php echo $default['de_sell_count']; ?> / 100)) * qty;
} else { // 추가옵션
total += (price - parseInt(price * <?php echo $default['de_sell_count']; ?> / 100)) * qty;
}
});
$("#sit_tot_price").empty().html("<span>총 금액. </span><strong>"+number_format(String(total))+"</strong> 원");
$("#sit_tot_price").trigger("price_calculate", [total]);
} else {
cached_function.apply(this, arguments); // use .apply() to call it
}
};
}());
} //end if check function
</script>
<?php
} else {
?>
<script src="<?php echo G5_JS_URL; ?>/shop.override.js"></script>
<?php
}
?>
10-1. lib / naverpay.lib.php
$uprice = get_price($it);
foreach($opts as $opt) {
if($opt['type'])
$price += ((int)$opt['price'] * (int)$opt['qty']);
를 아래와 같이 변경
$uprice = get_price($it);
// 일괄할인 (1/2)
//if ($default['de_sell_count'] > 0 && ($member['mb_id']=='테스트아이디')) { // 일괄할인 테스트
if ($default['de_sell_count'] > 0) { // 일괄할인 실사용
$uprice = (int)($uprice - $uprice * $default['de_sell_count'] / 100);
}
foreach($opts as $opt) {
//if($opt['type'])
// $price += ((int)$opt['price'] * (int)$opt['qty']);
if($opt['type']) {
// 일괄할인
if ($default['de_sell_count'] > 0) { // 일괄할인 실사용
$price += (((int)$opt['price'] - (int)($opt['price'] * $default['de_sell_count'] / 100)) * (int)$opt['qty']);
} else {
$price += ((int)$opt['price'] * (int)$opt['qty']);
}
}
10-2. lib / naverpay.lib.php
$uprice = get_price($it);
$tprice = 0;
foreach($opts as $opt) {
if($opt['type'])
$tprice = ((int)$opt['price'] * (int)$opt['qty']);
else
$tprice = (((int)$uprice + (int)$opt['price']) * (int)$opt['qty']);
를 아래와 같이 변경
$uprice = get_price($it);
// 일괄할인 (2/2)
//if ($default['de_sell_count'] > 0 && ($member['mb_id']=='테스트아이디')) { // 일괄할인 테스트
if ($default['de_sell_count'] > 0) { // 일괄할인 실사용
$uprice = $uprice - (int)($uprice * $default['de_sell_count'] / 100);
}
$tprice = 0;
foreach($opts as $opt) {
//if($opt['type'])
// $tprice = ((int)$opt['price'] * (int)$opt['qty']);
//else
// $tprice = (((int)$uprice + (int)$opt['price']) * (int)$opt['qty']);
if($opt['type']) {
// 일괄할인
if ($default['de_sell_count'] > 0) { // 일괄할인 실사용
$tprice = (((int)($opt['price'] - (int)($opt['price'] * $default['de_sell_count'] / 100))) * (int)$opt['qty']);
} else {
$tprice = ((int)$opt['price'] * (int)$opt['qty']);
}
} else {
//$tprice = (((int)$uprice + (int)$opt['price']) * (int)$opt['qty']);
// 일괄할인
if ($default['de_sell_count'] > 0) { // 일괄할인 실사용
$tprice = (((int)$uprice + (int)($opt['price'] - (int)($opt['price'] * $default['de_sell_count'] / 100))) * (int)$opt['qty']);
} else {
$tprice = (((int)$uprice + (int)$opt['price']) * (int)$opt['qty']);
}
}
11. shop / naverpay / naver_item.php
$price = get_price($it);
아래에 내용 추가
// 일괄할인
//if ($default['de_sell_count'] > 0 && ($member['mb_id']=='테스트아이디')) { // 일괄할인 테스트
if ($default['de_sell_count'] > 0) { // 일괄할인 실사용
$price = $price - (int)($price * $default['de_sell_count'] / 100);
}
12. shop / naverpay / naver_order.php
$it_price = get_price($it);
아래에 내용 추가
// 일괄할인
//if ($default['de_sell_count'] > 0 && ($member['mb_id']=='테스트아이디')) { // 일괄할인 테스트
if ($default['de_sell_count'] > 0) { // 일괄할인 실사용실사용
$io_price = $io_price - (int)($io_price * $default['de_sell_count'] / 100);
$it_price = get_price($it) - (int)(get_price($it) * $default['de_sell_count'] / 100);
}
이윰빌더 사용시 작업
1. adm / eyoom_admin / core / basic / skin/ shop / itemsellform.php 생성
<?php
if (!defined('_EYOOM_IS_ADMIN_')) exit;
$sub_menu = '400310';
include_once('./_common.php');
auth_check($auth[$sub_menu], "w");
$action_url1 = G5_ADMIN_URL . '/?dir=shop&pid=itemsellformupdate&smode=1';
// 재입고알림 설정 필드 추가
if(!sql_query(" select de_sell_count from {$g5['g5_shop_default_table']} limit 1 ", false)) {
sql_query(" ALTER TABLE `{$g5['g5_shop_default_table']}`
ADD `de_sell_count` tinyint(4) NOT NULL DEFAULT '0' COMMENT '일괄할인' ", true);
}
2. adm / eyoom_admin / core / basic / skin/ shop / itemsellformupdate.php 생성
<?php
if (!defined('_EYOOM_IS_ADMIN_')) exit;
$sub_menu = '400310';
include_once('./_common.php');
check_demo();
auth_check($auth[$sub_menu], "w");
check_admin_token();
$sql = " update {$g5['g5_shop_default_table']}
set de_sell_count = '{$_POST['de_sell_count']}'
";
sql_query($sql);
//goto_url("./itemsellform.php");
alert("적용하였습니다.", G5_ADMIN_URL . "/?dir=shop&pid=itemsellform");
3. adm / eyoom_admin / theme / basic / skin/ shop / itemsellform.html.php 생성
<?php
if (!defined('_EYOOM_IS_ADMIN_')) exit;
add_stylesheet('<link rel="stylesheet" href="'.EYOOM_ADMIN_THEME_URL.'/plugins/jsgrid/jsgrid.min.css" type="text/css" media="screen">',0);
add_stylesheet('<link rel="stylesheet" href="'.EYOOM_ADMIN_THEME_URL.'/plugins/jsgrid/jsgrid-theme.min.css" type="text/css" media="screen">',0);
?>
<form name="fitemform" action="<?php echo $action_url1; ?>" method="post" enctype="MULTIPART/FORM-DATA" autocomplete="off" onsubmit="return fitemformcheck(this)">
<input type="hidden" name="w" value="<?php echo $w; ?>">
<section id="anc_sitfrm_cate">
<h2 class="h2_frm">일괄할인</h2>
<?php echo $pg_anchor; ?>
<div class="local_desc02 local_desc">
<p>제품 가격을 비율로 일괄 할인 판매합니다</p>
</div>
<div class="tbl_frm01 tbl_wrap">
<table>
<caption>일괄할인</caption>
<colgroup>
<col class="grid_4">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row"><label for="de_sell_count">일괄할인</label></th>
<td>
<?php echo help("할인율이 0 이상일때 할인율이 작동합니다"); ?>
<input type="text" name="de_sell_count" value="<?php echo $default['de_sell_count']; ?>" id="de_sell_count" class="frm_input" size="8"> %
</td>
</tr>
</tbody>
</table>
</div>
</section>
<div class="btn_fixed_top">
<input type="submit" value="확인" class="btn_submit btn" accesskey="s">
</div>
</form>
<script>
var f = document.fitemform;
</script>
4. theme / eyoom_basic / skin / shop / basic / list10.skin.html.php
<?php if ($this->view_it_price) { ?>
<span class="title-price">₩ <?php echo $list[$i]['it_tel_inq']; ?></span>
<?php } ?>
<?php if ($this->view_it_cust_price && $list[$i]['it_cust_price']) { ?>
<span class="title-price line-through">₩ <?php echo $list[$i]['it_cust_price']; ?></span>
<?php } ?>
를 아래와 같이 변경
<?php
// 일괄할인
//if ($default['de_sell_count'] > 0 && ($member['mb_id']=='테스트아이디')) { // 일괄할인 테스트
if ($default['de_sell_count'] > 0) { // 일괄할인 실사용
?>
<?php if ($this->view_it_price) { ?>
<span class="title-price"><strike>₩ <?php echo $list[$i]['it_tel_inq']; ?></strike></span>
<?php echo " <span style='font-size:0.8em;'>({$default['de_sell_count']}% 할인)</span><br> "; ?>
<span class="title-price">₩ <?php echo number_Format($list[$i]['it_price'] - (int)($list[$i]['it_price'] * $default['de_sell_count'] / 100)); ?></span>
<?php } ?>
<?php if ($this->view_it_cust_price && $list[$i]['it_cust_price']) { ?>
<span class="title-price line-through">₩ <?php echo $list[$i]['it_cust_price']; ?></span>
<?php } ?>
<?php
} else {
?>
<?php if ($this->view_it_price) { ?>
<span class="title-price">₩ <?php echo $list[$i]['it_tel_inq']; ?></span>
<?php } ?>
<?php if ($this->view_it_cust_price && $list[$i]['it_cust_price']) { ?>
<span class="title-price line-through">₩ <?php echo $list[$i]['it_cust_price']; ?></span>
<?php } ?>
<?php
}
?>
5. theme / eyoom_basic / skin / shop / basic / item.form.skin.html.php
<tr>
<th scope="row">판매가격</th>
<td>
<strong class="shop-product-prices"><?php echo display_price(get_price($it)); ?></strong>
<input type="hidden" id="it_price" value="<?php echo get_price($it); ?>">
<?php if ($it['it_cust_price']) { ?>
<span class="line-through"><?php echo display_price($it['it_cust_price']); ?></span>
<?php } ?>
</td>
</tr>
를 아래와 같이 변경
<tr>
<th scope="row">판매가격</th>
<td>
<?php
//if ($default['de_sell_count'] > 0 && ($member['mb_id']=='테스트아이디')) { // 일괄할인 테스트
if ($default['de_sell_count'] > 0) { // 일괄할인 실사용
?>
<br>
<strong><strike><?php echo display_price(get_price($it)); ?></strike></strong> <?php echo $default['de_sell_count']; ?>% 할인<br>
<strong class="shop-product-prices"><?php echo display_price(get_price($it) - (int)(get_price($it) * $default['de_sell_count'] / 100)); ?></strong>
<input type="hidden" id="it_price" value="<?php echo get_price($it) - (int)(get_price($it) * $default['de_sell_count'] / 100); ?>">
<?php if ($it['it_cust_price']) { ?>
<span class="line-through"><?php echo display_price($it['it_cust_price']); ?></span>
<?php } ?>
<?php
} else {
?>
<strong class="shop-product-prices"><?php echo display_price(get_price($it)); ?></strong>
<input type="hidden" id="it_price" value="<?php echo get_price($it); ?>">
<?php if ($it['it_cust_price']) { ?>
<span class="line-through"><?php echo display_price($it['it_cust_price']); ?></span>
<?php } ?>
<?php
}
?>
</td>
</tr>
6. theme / eyoom_basic / skin / shop / basic / item.form.skin.html.php
<script src="<?php echo G5_JS_URL; ?>/shop.override.js"></script>
를 아래와 같이 변경
<?php
// 일괄할인
if ($default['de_sell_count'] > 0) { // 일괄할인 실사용
?>
<script src="<?php echo G5_JS_URL; ?>/shop.override_sell_count.js?ver=<?php //echo time(); ?>"></script>
<script>
if (typeof price_calculate === "function") {
price_calculate = (function() {
var cached_function = price_calculate;
return function() {
if( $(".2017_renewal_itemform").length ){
var it_price = parseInt($("input#it_price").val());
if(isNaN(it_price))
return;
var $el_prc = $("input.io_price");
var $el_qty = $("input[name^=ct_qty]");
var $el_type = $("input[name^=io_type]");
var price, type, qty, total = 0;
$el_prc.each(function(index) {
price = parseInt($(this).val());
qty = parseInt($el_qty.eq(index).val());
type = $el_type.eq(index).val();
if(type == "0") { // 선택옵션
total += (it_price + price - parseInt(price * <?php echo $default['de_sell_count']; ?> / 100)) * qty;
} else { // 추가옵션
total += (price - parseInt(price * <?php echo $default['de_sell_count']; ?> / 100)) * qty;
}
});
$("#sit_tot_price").empty().html("<span>총 금액. </span><strong>"+number_format(String(total))+"</strong> 원");
$("#sit_tot_price").trigger("price_calculate", [total]);
} else {
cached_function.apply(this, arguments); // use .apply() to call it
}
};
}());
} //end if check function
</script>
<?php
} else {
?>
<script src="<?php echo G5_JS_URL; ?>/shop.override.js"></script>
<?php
}
?>
댓글목록
등록된 댓글이 없습니다.