#209 모바일 쇼핑몰 쿠폰 기능 추가

This commit is contained in:
chicpro
2013-06-10 18:50:08 +09:00
parent 0247efe01e
commit 82dd70e594
11 changed files with 1093 additions and 104 deletions

View File

@ -1161,6 +1161,20 @@ function array_add_callback($func, $array)
return $array;
}
// 상품포인트
function get_item_point($it)
{
$it_point = 0;
if($it['it_point_type']) {
$it_point = floor(($it['it_price'] * ($it['it_point'] / 100) / 10)) * 10;
} else {
$it_point = $it['it_point'];
}
return $it_point;
}
//==============================================================================
// 쇼핑몰 함수 모음 끝
//==============================================================================

View File

@ -3,18 +3,257 @@ include_once('./_common.php');
$g4['title'] = '장바구니';
include_once(G4_MSHOP_PATH.'/_head.php');
$s_uq_id = get_session('ss_uq_id');
?>
<script src="<?php echo G4_JS_URL; ?>/shop.js"></script>
<div id="sod_bsk">
<form name="frmcartlist" id="sod_bsk_list" method="post">
<table class="basic_tbl">
<thead>
<tr>
<th scope="col">상품이미지</th>
<th scope="col">상품명</th>
<th scope="col">총수량</th>
<th scope="col">판매가</th>
<th scope="col">소계</th>
<th scope="col">포인트</th>
<th scope="col"><input type="checkbox" name="ct_all" value="1"></th>
</tr>
</thead>
<tbody>
<?php
$s_page = 'cart.php';
$s_uq_id = get_session('ss_uq_id');
include G4_MSHOP_PATH.'/cartsub.inc.php';
$tot_point = 0;
$tot_sell_amount = 0;
// $s_uq_id 로 현재 장바구니 자료 쿼리
$sql = " select a.ct_id,
a.it_id,
a.it_name,
a.ct_price,
a.ct_point,
a.ct_qty,
a.ct_status,
b.ca_id
from {$g4['shop_cart_table']} a left join {$g4['shop_item_table']} b on ( a.it_id = b.it_id )
where a.uq_id = '$s_uq_id'
and a.ct_num = '0' ";
if($default['de_cart_keep_term']) {
$ctime = date('Y-m-d H:i:s', G4_SERVER_TIME - ($default['de_cart_keep_term'] * 86400));
$sql .= " and a.ct_time > '$ctime' ";
}
$sql .= " order by a.ct_id ";
$result = sql_query($sql);
$good_info = '';
for ($i=0; $row=mysql_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_point * ct_qty) as point,
SUM(ct_qty) as qty
from {$g4['shop_cart_table']}
where it_id = '{$row['it_id']}'
and uq_id = '$s_uq_id' ";
$sum = sql_fetch($sql);
if ($i==0) { // 계속쇼핑
$continue_ca_id = $row['ca_id'];
}
$a1 = '<a href="./item.php?it_id='.$row['it_id'].'"><b>';
$a2 = '</b></a>';
$image = get_it_image($row['it_id'], 70, 70);
$it_name = $a1 . stripslashes($row['it_name']) . $a2;
$it_options = print_item_options($row['it_id'], $s_uq_id);
if($it_options) {
$mod_options = '<div class="sod_option_btn"><button type="button" class="mod_options">선택사항수정</button></div>';
$it_name .= '<div class="sod_bsk_itopt">'.$it_options.'</div>';
}
$point = $sum['point'];
$sell_amount = $sum['price'];
?>
<tr>
<td class="sod_bsk_img"><?php echo $image; ?></td>
<td>
<input type="hidden" name="it_id[<?php echo $i; ?>]" value="<?php echo $row['it_id']; ?>">
<input type="hidden" name="it_name[<?php echo $i; ?>]" value="<?php echo get_text($row['it_name']); ?>">
<?php echo $it_name.$mod_options; ?>
</td>
<td class="td_num"><?php echo number_format($sum['qty']); ?></td>
<td class="td_bignum"><?php echo number_format($row['ct_price']); ?></td>
<td class="td_bignum"><?php echo number_format($sell_amount); ?></td>
<td class="td_num"><?php echo number_format($sum['point']); ?></td>
<td class="td_smallmng"><input type="checkbox" name="ct_chk[<?php echo $i; ?>]" value="1"></td>
</tr>
<?php
$tot_point += $point;
$tot_sell_amount += $sell_amount;
} // for 끝
if ($i == 0) {
echo '<tr><td colspan="7" class="empty_table">장바구니에 담긴 상품이 없습니다.</td></tr>';
} else {
// 배송비 계산
if ($default['de_send_cost_case'] == '없음')
$send_cost = 0;
else {
// 배송비 상한 : 여러단계의 배송비 적용 가능
$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];
break;
}
}
}
}
?>
</tbody>
</table>
<?php
// 배송비가 0 보다 크다면 (있다면)
if ($send_cost > 0)
{
?>
<div id="sod_bsk_dvr" class="sod_bsk_tot">
<span>배송비</span>
<strong><?php echo number_format($send_cost); ?> 원</strong>
</div>
<?php } ?>
<?php
// 총계 = 주문상품금액합계 + 배송비
$tot_amount = $tot_sell_amount + $send_cost;
if ($tot_amount > 0) {
?>
<div id="sod_bsk_cnt" class="sod_bsk_tot">
<span>총계</span>
<strong><?php echo number_format($tot_amount); ?> 원 <?php echo number_format($tot_point); ?> 점</strong>
</div>
<?php } ?>
<div id="sod_bsk_act">
<?php if ($i == 0) { ?>
<a href="<?php echo G4_SHOP_URL; ?>/" class="btn01">쇼핑 계속하기</a>
<?php } else { ?>
<input type="hidden" name="url" value="<?php echo G4_SHOP_URL; ?>/orderform.php">
<input type="hidden" name="act" value="">
<input type="hidden" name="records" value="<?php echo $i; ?>">
<p>장바구니의 상품을 주문하시려면 <strong>주문하기</strong>를 클릭하세요. <strong>비우기</strong>는 장바구니의 상품을 모두 비웁니다.</p>
<a href="<?php echo G4_SHOP_URL; ?>/list.php?ca_id=<?php echo $continue_ca_id; ?>" class="btn01">쇼핑 계속하기</a>
<a href="javascript:form_check('buy');" class="btn02">주문하기</a>
<a href="javascript:form_check('seldelete');" class="btn01">선택삭제</a>
<a href="javascript:form_check('alldelete');" class="btn01">비우기</a>
<?php } ?>
</div>
</form>
</div>
<script>
$(function() {
var close_btn_idx;
// 선택사항수정
$(".mod_options").click(function() {
var it_id = $(this).closest("tr").find("input[name^=it_id]").val();
var $this = $(this);
close_btn_idx = $(".mod_options").index($(this));
winMask(); // 모달 윈도우 배경 출력
$.post(
"./cartoption.php",
{ it_id: it_id },
function(data) {
$("#mod_option_frm").remove();
$this.after("<div id=\"mod_option_frm\"></div>");
$("#mod_option_frm").html(data);
price_calculate();
}
);
});
// 모두선택
$("input[name=ct_all]").click(function() {
if($(this).is(":checked"))
$("input[name^=ct_chk]").attr("checked", true);
else
$("input[name^=ct_chk]").attr("checked", false);
});
// 옵션수정 닫기
$("#mod_option_close").live("click", function() {
$("#mod_option_frm").remove();
$("#win_mask, .window").hide();
$(".mod_options").eq(close_btn_idx).focus();
});
$("#win_mask").click(function () {
$("#mod_option_frm").remove();
$("#win_mask").hide();
$(".mod_options").eq(close_btn_idx).focus();
});
});
function form_check(act) {
var f = document.frmcartlist;
var cnt = f.records.value;
if (act == "buy")
{
f.act.value = act;
<?php
if (get_session('ss_mb_id')) // 회원인 경우
{
echo "f.action = './orderform.php';";
echo "f.submit();";
}
else
echo "document.location.href = '".G4_BBS_URL."/login.php?url=".urlencode(G4_SHOP_URL."/orderform.php")."';";
?>
}
else if (act == "alldelete")
{
f.act.value = act;
f.action = "./cartupdate.php";
f.submit();
}
else if (act == "seldelete")
{
if($("input[name^=ct_chk]:checked").size() < 1) {
alert("삭제하실 상품을 하나이상 선택해 주십시오.");
return false;
}
f.act.value = act;
f.action = "./cartupdate.php";
f.submit();
}
return true;
}
</script>
<?php
include_once(G4_MSHOP_PATH.'/_tail.php');
?>

View File

@ -334,12 +334,7 @@ else
<th scope="row"><label for="disp_point">포인트</label></th>
<td>
<?php
if($it['it_point_type']) {
$it_point = floor(($it['it_price'] * ($it['it_point'] / 100) / 10)) * 10;
} else {
$it_point = $it['it_point'];
}
$it_point = get_item_point($it);
echo number_format($it_point);
?> 점
<input type="hidden" name="it_point" value="<?php echo $it_point; ?>">

View File

@ -13,9 +13,6 @@ else {
if (get_cart_count($tmp_uq_id) == 0)
alert('장바구니가 비어 있습니다.', G4_SHOP_URL.'/cart.php');
// 포인트 결제 대기 필드 추가
//sql_query(" ALTER TABLE `$g4[shop_order_table]` ADD `od_temp_point` INT NOT NULL AFTER `od_temp_card` ", false);
$g4['title'] = '주문서 작성';
include_once(G4_MSHOP_PATH.'/_head.php');
@ -24,35 +21,214 @@ include_once(G4_MSHOP_PATH.'/_head.php');
$od_id = get_uniqid();
set_session('ss_order_uniqid', $od_id);
$s_uq_id = $tmp_uq_id;
$order_action_url = G4_HTTPS_MSHOP_URL.'/orderformupdate.php';
if (file_exists('./settle_'.$default['de_card_pg'].'.inc.php')) {
include './settle_'.$default['de_card_pg'].'.inc.php';
}
// 결제등록 요청시 사용할 입금마감일
$ipgm_date = date("Ymd", (G4_SERVER_TIME + 86400 * 5));
$tablet_size = "1.0"; // 화면 사이즈 조정 - 기기화면에 맞게 수정(갤럭시탭,아이패드 - 1.85, 스마트폰 - 1.0)
?>
<div id="sod_frm">
<div id="sod_approval_frm">
<?php
ob_start();
?>
<p>주문하실 상품을 확인하세요.</p>
<table class="basic_tbl">
<thead>
<tr>
<th scope="col">상품이미지</th>
<th scope="col">상품명</th>
<th scope="col">총수량</th>
<th scope="col">판매가</th>
<th scope="col">쿠폰</th>
<th scope="col">소계</th>
<th scope="col">포인트</th>
<th scope="col"><input type="checkbox" name="ct_all" value="1"></th>
</tr>
</thead>
<tbody>
<?php
$tot_point = 0;
$tot_sell_amount = 0;
$goods = $goods_it_id = "";
$goods_count = -1;
// $s_uq_id 로 현재 장바구니 자료 쿼리
$sql = " select a.ct_id,
a.it_id,
a.it_name,
a.ct_price,
a.ct_point,
a.ct_qty,
a.ct_status,
b.ca_id
from {$g4['shop_cart_table']} a left join {$g4['shop_item_table']} b on ( a.it_id = b.it_id )
where a.uq_id = '$s_uq_id'
and a.ct_num = '0' ";
if($default['de_cart_keep_term']) {
$ctime = date('Y-m-d H:i:s', G4_SERVER_TIME - ($default['de_cart_keep_term'] * 86400));
$sql .= " and a.ct_time > '$ctime' ";
}
$sql .= " order by a.ct_id ";
$result = sql_query($sql);
$good_info = '';
for ($i=0; $row=mysql_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_point * ct_qty) as point,
SUM(ct_qty) as qty
from {$g4['shop_cart_table']}
where it_id = '{$row['it_id']}'
and uq_id = '$s_uq_id' ";
$sum = sql_fetch($sql);
if (!$goods)
{
//$goods = addslashes($row[it_name]);
//$goods = get_text($row[it_name]);
$goods = preg_replace("/\'|\"|\||\,|\&|\;/", "", $row['it_name']);
$goods_it_id = $row['it_id'];
}
$goods_count++;
// 에스크로 상품정보
if($default['de_escrow_use']) {
if ($i>0)
$good_info .= chr(30);
$good_info .= "seq=".($i+1).chr(31);
$good_info .= "ordr_numb={$od_id}_".sprintf("%04d", $i).chr(31);
$good_info .= "good_name=".addslashes($row['it_name']).chr(31);
$good_info .= "good_cntx=".$row['ct_qty'].chr(31);
$good_info .= "good_amtx=".$row['ct_price'].chr(31);
}
$a1 = '<b>';
$a2 = '</b>';
$image = get_it_image($row['it_id'], 50, 50);
$it_name = $a1 . stripslashes($row['it_name']) . $a2;
$it_options = print_item_options($row['it_id'], $s_uq_id);
if($it_options) {
$it_name .= '<div class="sod_bsk_itopt">'.$it_options.'</div>';
}
$point = $sum['point'];
$sell_amount = $sum['price'];
// 쿠폰
if($is_member) {
$cp_button = '';
$sql = " select count(*) as cnt
from {$g4['shop_coupon_table']}
where mb_id = '{$member['mb_id']}'
and cp_used = '0'
and cp_start <= '".G4_TIME_YMD."'
and cp_end >= '".G4_TIME_YMD."'
and (
( cp_method = '0' and cp_target = '{$row['it_id']}' )
OR
( cp_method = '1' and ( cp_target IN ( '{$row['ca_id']}', '{$row['ca_id2']}', '{$row['ca_id3']}' ) ) )
) ";
$cp = sql_fetch($sql);
if($cp['cnt'])
$cp_button = '<button type="button" class="it_coupon_btn">적용</button>';
}
?>
<tr>
<td class="sod_bsk_img"><?php echo $image; ?></td>
<td>
<input type="hidden" name="it_id[<?php echo $i; ?>]" value="<?php echo $row['it_id']; ?>">
<input type="hidden" name="it_name[<?php echo $i; ?>]" value="<?php echo get_text($row['it_name']); ?>">
<input type="hidden" name="it_amount[<?php echo $i; ?>]" value="<?php echo $sell_amount; ?>">
<input type="hidden" name="cp_id[<?php echo $i; ?>]" value="">
<input type="hidden" name="cp_amount[<?php echo $i; ?>]" value="0">
<?php echo $it_name.$mod_options; ?>
</td>
<td class="td_num"><?php echo number_format($sum['qty']); ?></td>
<td class="td_bignum"><?php echo number_format($row['ct_price']); ?></td>
<td><?php echo $cp_button; ?></td>
<td class="td_bignum"><span class="ct_sell_amount"><?php echo number_format($sell_amount); ?></span></td>
<td class="td_num"><?php echo number_format($sum['point']); ?></td>
</tr>
<?php
$s_page = 'orderform.php';
$s_uq_id = $tmp_uq_id;
$tot_point += $point;
$tot_sell_amount += $sell_amount;
} // for 끝
echo '<p>주문하실 상품을 확인하세요.</p>';
include_once(G4_MSHOP_PATH.'/cartsub.inc.php');
if (file_exists(G4_MSHOP_PATH.'/settle_'.$default['de_card_pg'].'.inc.php')) {
include G4_MSHOP_PATH.'/settle_'.$default['de_card_pg'].'.inc.php';
if ($i == 0) {
echo '<tr><td colspan="'.$colspan.'" class="empty_table">장바구니에 담긴 상품이 없습니다.</td></tr>';
} else {
// 배송비 계산
if ($default['de_send_cost_case'] == '없음')
$send_cost = 0;
else {
// 배송비 상한 : 여러단계의 배송비 적용 가능
$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];
break;
}
}
}
}
$good_mny = (int)$tot_sell_amount + (int)$send_cost;
$order_action_url = G4_HTTPS_MSHOP_URL.'/orderformupdate.php';
?>
</tbody>
</table>
<?php if ($goods_count) $goods .= ' 외 '.$goods_count.'건'; ?>
<?php
// 배송비가 0 보다 크다면 (있다면)
if ($send_cost > 0)
{
?>
<div id="sod_bsk_dvr" class="sod_bsk_tot">
<span>배송비</span>
<strong><?php echo number_format($send_cost); ?> 원</strong>
</div>
<?php } ?>
<?php
// 총계 = 주문상품금액합계 + 배송비
$tot_amount = $tot_sell_amount + $send_cost;
if ($tot_amount > 0) {
?>
<div id="sod_bsk_cnt" class="sod_bsk_tot">
<span>총계</span>
<strong><span id="ct_tot_amount"><?php echo number_format($tot_amount); ?></span> 원 <?php echo number_format($tot_point); ?> 점</strong>
</div>
<?php } ?>
<?php
$content = ob_get_contents();
ob_end_clean();
?>
<!-- 거래등록 하는 kcp 서버와 통신을 위한 스크립트-->
<script src="<?php echo G4_MSHOP_URL; ?>/kcp/approval_key.js"></script>
<form name="sm_form" method="POST" action="<?php echo G4_MSHOP_URL; ?>/kcp/order_approval_form.php">
<input type="hidden" name="good_name" value="<?php echo $goods; ?>">
<input type="hidden" name="good_mny" value="<?php echo $good_mny; ?>" >
<input type="hidden" name="good_mny" value="<?php echo $tot_amount ?>" >
<input type="hidden" name="buyr_name" value="">
<input type="hidden" name="buyr_tel1" value="">
<input type="hidden" name="buyr_tel2" value="">
@ -108,10 +284,16 @@ $tablet_size = "1.0"; // 화면 사이즈 조정 - 기기화면에 맞게 수정
<input type="hidden" name="kcp_noint_quota" value="CCBC-02:03:06,CCKM-03:06,CCSS-03:06:09"/> */
-->
</form>
</div>
<div id="sod_frm">
<form name="forderform" method="post" action="<?php echo $order_action_url; ?>" onsubmit="return forderform_check(this);" autocomplete="off">
<input type="hidden" name="od_amount" value="<?php echo $tot_sell_amount; ?>">
<input type="hidden" name="org_od_amount" value="<?php echo $tot_sell_amount; ?>">
<input type="hidden" name="od_send_cost" value="<?php echo $send_cost; ?>">
<input type="hidden" name="org_send_cost" value="<?php echo $send_cost; ?>">
<?php echo $content; ?>
<section id="sod_frm_orderer">
<h2>주문하시는 분</h2>
@ -240,9 +422,64 @@ $tablet_size = "1.0"; // 화면 사이즈 조정 - 기기화면에 맞게 수정
</table>
</section>
<?php
if($is_member) {
// 주문쿠폰
$sql = " select count(*) as cnt
from {$g4['shop_coupon_table']}
where mb_id = '{$member['mb_id']}'
and cp_method = '2'
and cp_start <= '".G4_TIM_YMD."'
and cp_end >= '".G4_TIME_YMD."'
and cp_used = '0' ";
$row = sql_fetch($sql);
$oc_cnt = $row['cnt'];
if($send_cost > 0) {
// 배송비쿠폰
$sql = " select count(*) as cnt
from {$g4['shop_coupon_table']}
where mb_id = '{$member['mb_id']}'
and cp_method = '3'
and cp_start <= '".G4_TIM_YMD."'
and cp_end >= '".G4_TIME_YMD."'
and cp_used = '0' ";
$row = sql_fetch($sql);
$sc_cnt = $row['cnt'];
}
}
?>
<section id="sod_frm_pay">
<h2>결제정보 입력</h2>
<table class="frm_tbl">
<tbody>
<?php if($oc_cnt > 0) { ?>
<tr>
<th scope="row">결제할인쿠폰</th>
<td>
<input type="hidden" name="od_cp_id" value="">
<button type="button" id="od_coupon_btn">쿠폰적용</button>
</td>
</tr>
<?php } ?>
<?php if($sc_cnt > 0) { ?>
<tr>
<th scope="row">배송비할인쿠폰</th>
<td>
<input type="hidden" name="sc_cp_id" value="">
<button type="button" id="sc_coupon_btn">쿠폰적용</button>
</td>
</tr>
<?php } ?>
<tr>
<th>총 주문금액</th>
<td><span id="od_tot_amount"><?php echo number_format($tot_amount); ?></span>원</td>
</tr>
</tbody>
</table>
<?php
$multi_settle == 0;
$checked = '';
@ -340,7 +577,7 @@ $tablet_size = "1.0"; // 화면 사이즈 조정 - 기기화면에 맞게 수정
$temp_point = $member_mileage;
echo '<div>결제포인트 : <input type="text" id="od_temp_point" name="od_temp_point" value="0" size="10">점 (100점 단위로 입력하세요.)</div>';
echo '<div>회원님의 보유포인트('.display_point($member['mb_mileage']).')중 <strong>'.display_point($temp_point).'</strong>(주문금액 '.$default['de_point_per'].'%) 내에서 결제가 가능합니다.</div>';
echo '<div>회원님의 보유포인트('.display_point($member['mb_mileage']).')중 <strong id="use_max_point">'.display_point($temp_point).'</strong>(주문금액 '.$default['de_point_per'].'%) 내에서 결제가 가능합니다.</div>';
$multi_settle++;
}
}
@ -358,8 +595,8 @@ $tablet_size = "1.0"; // 화면 사이즈 조정 - 기기화면에 맞게 수정
if ($temp_point > $member_point)
$temp_point = $member_point;
echo '<div>결제포인트 : <input type="text" id="od_temp_point" name="od_temp_point" value="0" size="10">점 (100점 단위로 입력하세요.)</div>';
echo '<div>회원님의 보유포인트('.display_point($member['mb_point']).')중 <strong>'.display_point($temp_point).'</strong>(주문금액 '.$default['de_point_per'].'%) 내에서 결제가 가능합니다.</div>';
echo '<div><input type="hidden" name="max_temp_point" value="<?php echo $temp_point; ?>"><input type="hidden" name="max_temp_point" value="<?php echo $temp_point; ?>">결제포인트 : <input type="text" id="od_temp_point" name="od_temp_point" value="0" size="10">점 (100점 단위로 입력하세요.)</div>';
echo '<div>회원님의 보유포인트('.display_point($member['mb_point']).')중 <strong id="use_max_point">'.display_point($temp_point).'</strong>(주문금액 '.$default['de_point_per'].'%) 내에서 결제가 가능합니다.</div>';
$multi_settle++;
}
}
@ -459,6 +696,279 @@ $tablet_size = "1.0"; // 화면 사이즈 조정 - 기기화면에 맞게 수정
</div>
<script>
$(function() {
var $cp_btn_el;
var $cp_row_el;
$(".it_coupon_btn").click(function() {
$cp_btn_el = $(this);
$cp_row_el = $(this).closest("tr");
$("#it_coupon_frm").remove();
var it_id = $cp_btn_el.closest("tr").find("input[name^=it_id]").val();
$.post(
"./orderitemcoupon.php",
{ it_id: it_id },
function(data) {
$cp_btn_el.after(data);
}
);
});
$(".cp_apply").live("click", function() {
var $el = $(this).closest("li");
var cp_id = $el.find("input[name='f_cp_id[]']").val();
var amount = $el.find("input[name='f_cp_amt[]']").val();
var subj = $el.find("input[name='f_cp_subj[]']").val();
var sell_amount;
if(parseInt(amount) == 0) {
if(!confirm(subj+"쿠폰의 할인 금액은 "+amount+"원입니다.\n쿠폰을 적용하시겠습니까?")) {
return false;
}
}
// 이미 사용한 쿠폰이 있는지
var cp_dup = false;
var cp_dup_idx;
var $cp_dup_el;
$("input[name^=cp_id]").each(function(index) {
var id = $(this).val();
if(id == cp_id) {
cp_dup_idx = index;
cp_dup = true;
$cp_dup_el = $(this).closest("tr");;
return false;
}
});
if(cp_dup) {
var it_name = $("input[name='it_name["+cp_dup_idx+"]']").val();
if(!confirm(subj+ "쿠폰은 "+it_name+"에 사용되었습니다.\n"+it_name+"의 쿠폰을 취소한 후 적용하시겠습니까?")) {
return false;
} else {
coupon_cancel($cp_dup_el);
}
}
var $s_el = $cp_row_el.find(".ct_sell_amount");;
sell_amount = parseInt($cp_row_el.find("input[name^=it_amount]").val());
sell_amount = sell_amount - parseInt(amount);
$s_el.text(number_format(String(sell_amount)));
$cp_row_el.find("input[name^=cp_id]").val(cp_id);
$cp_row_el.find("input[name^=cp_amount]").val(amount);
calculate_total_amount();
$("#it_coupon_frm").remove();
$cp_btn_el.focus();
});
$("#it_coupon_close").live("click", function() {
$("#it_coupon_frm").remove();
$cp_btn_el.focus();
});
$("#it_coupon_cancel").live("click", function() {
coupon_cancel($cp_row_el);
calculate_total_amount();
$("#it_coupon_frm").remove();
$cp_btn_el.focus();
});
$("#od_coupon_btn").click(function() {
$("#od_coupon_frm").remove();
var $this = $(this);
var amount = parseInt($("input[name=org_od_amount]").val());
var send_cost = parseInt($("input[name=org_send_cost]").val());
$.post(
"./ordercoupon.php",
{ amount: (amount + send_cost) },
function(data) {
$this.after(data);
}
);
});
$(".od_cp_apply").live("click", function() {
var $el = $(this).closest("li");
var cp_id = $el.find("input[name='o_cp_id[]']").val();
var amount = parseInt($el.find("input[name='o_cp_amt[]']").val());
var subj = $el.find("input[name='o_cp_subj[]']").val();
var od_amount = parseInt($("input[name=org_od_amount]").val());
var send_cost = $("input[name=org_send_cost]").val();
if(parseInt(amount) == 0) {
if(!confirm(subj+"쿠폰의 할인 금액은 "+amount+"원입니다.\n쿠폰을 적용하시겠습니까?")) {
return false;
}
}
$("input[name=od_send_cost]").val(send_cost);
$("input[name=sc_cp_id]").val("");
$("input[name=od_amount]").val(od_amount - amount);
$("input[name=od_cp_id]").val(cp_id);
calculate_order_amount();
$("#od_coupon_frm").remove();
$("#od_coupon_btn").focus();
});
$("#od_coupon_close").live("click", function() {
$("#od_coupon_frm").remove();
$("#od_coupon_btn").focus();
});
$("#od_coupon_cancel").live("click", function() {
var org_amount = $("input[name=org_od_amount]").val();
$("input[name=od_amount]").val(org_amount);
calculate_order_amount();
$("#od_coupon_frm").remove();
$("#od_coupon_btn").focus();
});
$("#sc_coupon_btn").click(function() {
$("#sc_coupon_frm").remove();
var $this = $(this);
var amount = parseInt($("input[name=od_amount]").val());
var send_cost = parseInt($("input[name=org_send_cost]").val());
$.post(
"./ordersendcostcoupon.php",
{ amount: (amount + send_cost), send_cost: send_cost },
function(data) {
$this.after(data);
}
);
});
$(".sc_cp_apply").live("click", function() {
var $el = $(this).closest("li");
var cp_id = $el.find("input[name='s_cp_id[]']").val();
var amount = parseInt($el.find("input[name='s_cp_amt[]']").val());
var subj = $el.find("input[name='s_cp_subj[]']").val();
var send_cost = parseInt($("input[name=org_send_cost]").val());
if(parseInt(amount) == 0) {
if(!confirm(subj+"쿠폰의 할인 금액은 "+amount+"원입니다.\n쿠폰을 적용하시겠습니까?")) {
return false;
}
}
$("input[name=od_send_cost]").val(send_cost - amount);
$("input[name=sc_cp_id]").val(cp_id);
calculate_order_amount();
$("#sc_coupon_frm").remove();
$("#sc_coupon_btn").focus();
});
$("#sc_coupon_close").live("click", function() {
$("#sc_coupon_frm").remove();
$("#sc_coupon_btn").focus();
});
$("#sc_coupon_cancel").live("click", function() {
var send_cost = $("input[name=org_send_cost]").val();
$("input[name=od_send_cost]").val(send_cost);
calculate_order_amount();
$("#sc_coupon_frm").remove();
$("#sc_coupon_btn").focus();
});
$("#od_settle_bank").bind("click", function() {
$("[name=od_deposit_name]").val( $("[name=od_b_name]").val() );
$("#settle_bank").show();
$("#show_req_btn").css("display", "none");
$("#show_pay_btn").css("display", "inline");
});
$("#od_settle_iche,#od_settle_card,#od_settle_vbank,#od_settle_hp").bind("click", function() {
$("#settle_bank").hide();
$("#show_req_btn").css("display", "inline");
$("#show_pay_btn").css("display", "none");
});
});
function coupon_cancel($el)
{
var $dup_sell_el = $el.find(".ct_sell_amount");
var $dup_amount_el = $el.find("input[name^=cp_amount]");
var org_sell_amount = $el.find("input[name^=it_amount]").val();
$dup_sell_el.text(number_format(String(org_sell_amount)));
$dup_amount_el.val(0);
$el.find("input[name^=cp_id]").val("");
}
function calculate_total_amount()
{
var $it_amt = $("input[name^=it_amount]");
var $cp_amt = $("input[name^=cp_amount]");
var tot_sell_amount = sell_amount = 0;
var it_amount, cp_amount;
var send_cost = parseInt($("input[name=org_send_cost]").val());
$it_amt.each(function(index) {
it_amount = parseInt($(this).val());
cp_amount = parseInt($cp_amt.eq(index).val());
sell_amount += (it_amount - cp_amount);
});
tot_sell_amount = sell_amount + send_cost;
$("#ct_tot_amount").text(number_format(String(tot_sell_amount)));
$("form[name=sm_form] input[name=good_mny]").val(tot_sell_amount);
$("input[name=od_amount]").val(sell_amount);
$("input[name=org_od_amount]").val(sell_amount);
$("input[name=od_send_cost]").val(send_cost);
<?php if($od_cnt > 0) { ?>
$("input[name=od_cp_id]").val("");
<?php } ?>
<?php if($sc_cnt > 0) { ?>
$("input[name=sc_cp_id]").val("");
<?php } ?>
$("input[name=od_temp_point]").val(0);
<?php if($temp_point > 0 && $is_member) { ?>
calculate_temp_point();
<?php } ?>
calculate_order_amount();
}
function calculate_order_amount()
{
var sell_amount = parseInt($("input[name=od_amount]").val());
var send_cost = parseInt($("input[name=od_send_cost]").val());
var tot_amount = sell_amount + send_cost;
$("form[name=sm_form] input[name=good_mny]").val(tot_amount);
$("#od_tot_amount").text(number_format(String(tot_amount)));
<?php if($temp_point > 0 && $is_member) { ?>
calculate_temp_point();
<?php } ?>
}
function calculate_temp_point()
{
<?php
if($default['de_mileage_use']) {
$point = (int)$member_mileage;
} else {
$point = (int)$member_point;
}
?>
var sell_amount = parseInt($("input[name=od_amount]").val());
var send_cost = parseInt($("input[name=od_send_cost]").val());
var point_per = <?php echo $default['de_point_per']; ?>;
var temp_point = parseInt((sell_amount + send_cost) * (point_per / 100) / 100) * 100;
var point = <?php echo $point; ?>
if(temp_point > point)
temp_point = point;
$("#use_max_point").text(number_format(String(temp_point))+"점");
$("input[name=max_temp_point]").val(temp_point);
}
/* 결제방법에 따른 처리 후 결제등록요청 실행 */
function kcp_approval()
{
@ -484,7 +994,9 @@ function kcp_approval()
}
var tot_amount = <?php echo (int)$tot_amount; ?>;
var max_point = <?php echo (int)$temp_point; ?>;
var max_point = 0;
if (typeof(f.max_temp_point) != "undefined")
max_point = parseInt(f.max_temp_point.value);
if (typeof(pf.od_temp_point) != "undefined") {
if (pf.od_temp_point.value)
@ -505,8 +1017,18 @@ function kcp_approval()
return false;
}
if (temp_point > <?php echo (int)$member['mb_point']; ?>) {
alert("회원님의 포인트보다 많이 결제할 수 없습니다.");
<?php
if($default['de_mileage_use']) {
$mb_point = $member['mb_mileage'];
$p_msg = '마일리지';
} else {
$mb_point = $member['mb_point'];
$p_msg = '포인트';
}
?>
if (temp_point > <?php echo (int)$mb_point; ?>) {
alert("회원님의 <?php echo $p_msg; ?>보다 많이 결제할 수 없습니다.");
pf.od_temp_point.select();
return false;
}
@ -629,7 +1151,8 @@ function forderform_check(f)
}
var tot_amount = <?php echo (int)$tot_amount; ?>;
var max_point = <?php echo (int)$temp_point; ?>;
if (typeof(f.max_temp_point) != "undefined")
var max_point = parseInt(f.max_temp_point.value);
var temp_point = 0;
if (typeof(f.od_temp_point) != "undefined") {
@ -649,8 +1172,18 @@ function forderform_check(f)
return false;
}
if (temp_point > <?php echo (int)$member['mb_point']; ?>) {
alert("회원님의 포인트보다 많이 결제할 수 없습니다.");
<?php
if($default['de_mileage_use']) {
$mb_point = $member['mb_mileage'];
$p_msg = '마일리지';
} else {
$mb_point = $member['mb_point'];
$p_msg = '포인트';
}
?>
if (temp_point > <?php echo (int)$mb_point; ?>) {
alert("회원님의 <?php echo $p_msg; ?>보다 많이 결제할 수 없습니다.");
f.od_temp_point.select();
return false;
}
@ -710,21 +1243,6 @@ function gumae2baesong(f)
f.od_b_addr1.value = f.od_addr1.value;
f.od_b_addr2.value = f.od_addr2.value;
}
$(function() {
$("#od_settle_bank").bind("click", function() {
$("[name=od_deposit_name]").val( $("[name=od_b_name]").val() );
$("#settle_bank").show();
$("#show_req_btn").css("display", "none");
$("#show_pay_btn").css("display", "inline");
});
$("#od_settle_iche,#od_settle_card,#od_settle_vbank,#od_settle_hp").bind("click", function() {
$("#settle_bank").hide();
$("#show_req_btn").css("display", "inline");
$("#show_pay_btn").css("display", "none");
});
});
</script>
<?php

View File

@ -3,11 +3,15 @@ include_once('./_common.php');
if(get_magic_quotes_gpc())
{
$_GET = array_map("stripslashes", $_GET);
$_POST = array_map("stripslashes", $_POST);
//$_GET = array_map("stripslashes", $_GET);
//$_POST = array_map("stripslashes", $_POST);
$_GET = array_add_callback("stripslashes", $_GET);
$_POST = array_add_callback("stripslashes", $_POST);
}
$_GET = array_map("mysql_real_escape_string", $_GET);
$_POST = array_map("mysql_real_escape_string", $_POST);
//$_GET = array_map("mysql_real_escape_string", $_GET);
//$_POST = array_map("mysql_real_escape_string", $_POST);
$_GET = array_add_callback("mysql_real_escape_string", $_GET);
$_POST = array_add_callback("mysql_real_escape_string", $_POST);
// 결제등록 완료 체크
if($od_settle_case != '무통장') {
@ -63,7 +67,106 @@ $i_temp_point = (int)$_POST['od_temp_point'];
$sql = " select SUM(IF(io_type = 1, (io_price * ct_qty), ((ct_price + io_price) * ct_qty))) as od_amount
from {$g4['shop_cart_table']} where uq_id = '$tmp_uq_id' ";
$row = sql_fetch($sql);
if ((int)$row['od_amount'] !== $i_amount) {
$tot_ct_amount = $row['od_amount'];
// 쿠폰금액계산
$tot_cp_amount = 0;
if($is_member) {
// 상품쿠폰
$tot_it_cp_amount = $tot_od_cp_amount = 0;
$it_cp_cnt = count($_POST['cp_id']);
$arr_it_cp_amt = array();
for($i=0; $i<$it_cp_cnt; $i++) {
$cid = $_POST['cp_id'][$i];
$it_id = $_POST['it_id'][$i];
$sql = " select cp_id, cp_method, cp_target, cp_type, cp_amount, cp_trunc, cp_minimum, cp_maximum
from {$g4['shop_coupon_table']}
where cp_id = '$cid'
and mb_id = '{$member['mb_id']}'
and cp_start <= '".G4_TIME_YMD."'
and cp_end >= '".G4_TIME_YMD."'
and cp_used = '0'
and cp_method IN ( 0, 1 ) ";
$cp = sql_fetch($sql);
if(!$cp['cp_id'])
continue;
// 분류할인인지
if($cp['cp_method']) {
$sql2 = " select it_id, ca_id, ca_id2, ca_id3
from {$g4['shop_item_table']}
where it_id = '$it_id' ";
$row2 = sql_fetch($sql2);
if(!$row2['it_id'])
continue;
if($row2['ca_id'] != $cp['cp_target'] && $row2['ca_id2'] != $cp['cp_target'] && $row2['ca_id3'] != $cp['cp_target'])
continue;
} else {
if($cp['cp_target'] != $it_id)
continue;
}
// 상품금액
$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 = '$tmp_uq_id'
and it_id = '$it_id' ";
$ct = sql_fetch($sql);
$item_price = $ct['sum_price'];
if($cp['cp_minimum'] > $item_price)
continue;
$dc = 0;
if($cp['cp_type']) {
$dc = floor(($item_price * ($cp['cp_amount'] / 100)) / $cp['cp_trunc']) * $cp['cp_trunc'];
} else {
$dc = $cp['cp_amount'];
}
if($cp['cp_maximum'] && $dc > $cp['cp_maximum'])
$dc = $cp['cp_maximum'];
$tot_it_cp_amount += $dc;
$arr_it_cp_amt[$it_id] = $dc;
}
$tot_od_amount = $tot_ct_amount - $tot_it_cp_amount;
// 주문쿠폰
if($_POST['od_cp_id']) {
$sql = " select cp_id, cp_type, cp_amount, cp_trunc, cp_minimum, cp_maximum
from {$g4['shop_coupon_table']}
where cp_id = '{$_POST['od_cp_id']}'
and mb_id = '{$member['mb_id']}'
and cp_start <= '".G4_TIME_YMD."'
and cp_end >= '".G4_TIME_YMD."'
and cp_used = '0'
and cp_method = '2' ";
$cp = sql_fetch($sql);
$dc = 0;
if($cp['cp_id'] && ($cp['cp_minimum'] <= $tot_od_amount)) {
if($cp['cp_type']) {
$dc = floor(($tot_od_amount * ($cp['cp_amount'] / 100)) / $cp['cp_trunc']) * $cp['cp_trunc'];
} else {
$dc = $cp['cp_amount'];
}
if($cp['cp_maximum'] && $dc > $cp['cp_maximum'])
$dc = $cp['cp_maximum'];
$tot_od_cp_amount = $dc;
$tot_od_amount -= $tot_od_cp_amount;
}
}
$tot_cp_amount = $tot_it_cp_amount + $tot_od_cp_amount;
}
if ((int)($row['od_amount'] - $tot_cp_amount) !== $i_amount) {
die("Error.");
}
@ -85,7 +188,41 @@ if ($default['de_send_cost_case'] == "없음") {
}
}
}
if ((int)$send_cost !== $i_send_cost) {
$tot_sc_cp_amount = 0;
if($is_member && $send_cost > 0) {
// 배송쿠폰
if($_POST['sc_cp_id']) {
$sql = " select cp_id, cp_type, cp_amount, cp_trunc, cp_minimum, cp_maximum
from {$g4['shop_coupon_table']}
where cp_id = '{$_POST['sc_cp_id']}'
and mb_id = '{$member['mb_id']}'
and cp_start <= '".G4_TIME_YMD."'
and cp_end >= '".G4_TIME_YMD."'
and cp_used = '0'
and cp_method = '3' ";
$cp = sql_fetch($sql);
$dc = 0;
if($cp['cp_id'] && ($cp['cp_minimum'] <= $tot_od_amount)) {
if($cp['cp_type']) {
$dc = floor(($tot_od_amount * ($cp['cp_amount'] / 100)) / $cp['cp_trunc']) * $cp['cp_trunc'];
} else {
$dc = $cp['cp_amount'];
}
if($cp['cp_maximum'] && $dc > $cp['cp_maximum'])
$dc = $cp['cp_maximum'];
if($dc > $send_cost)
$dc = $send_cost;
$tot_sc_cp_amount = $dc;
}
}
}
if ((int)($send_cost - $tot_sc_cp_amount) !== $i_send_cost) {
die("Error..");
}
@ -259,6 +396,8 @@ $sql = " insert {$g4['shop_order_table']}
od_deposit_name = '$od_deposit_name',
od_memo = '$od_memo',
od_send_cost = '$od_send_cost',
od_send_coupon = '$tot_sc_cp_amount',
od_coupon = '$tot_od_cp_amount',
od_temp_bank = '$od_temp_bank',
od_temp_card = '$od_receipt_card',
od_temp_hp = '$od_receipt_hp',
@ -330,6 +469,54 @@ include_once(G4_MSHOP_PATH.'/kcp/pp_ax_hub_result.php');
$od_memo = nl2br(htmlspecialchars2(stripslashes($od_memo))) . "&nbsp;";
// 쿠폰사용내역기록
if($is_member) {
$it_cp_cnt = count($_POST['cp_id']);
for($i=0; $i<$it_cp_cnt; $i++) {
$cid = $_POST['cp_id'][$i];
$cp_it_id = $_POST['it_id'][$i];
$sql = " update {$g4['shop_coupon_table']}
set od_id = '$od_id',
cp_used = '1',
cp_used_time = '".G4_TIME_YMDHIS."'
where cp_id = '$cid'
and mb_id = '{$member['mb_id']}'
and cp_method IN ( 0, 1 ) ";
sql_query($sql);
// 쿠폰사용금액 cart에 기록
$cp_amt = (int)$arr_it_cp_amt[$cp_it_id];
$sql = " update {$g4['shop_cart_table']}
set cp_amount = '$cp_amt'
where uq_id = '$tmp_uq_id'
and it_id = '$cp_it_id'
and ct_num = '0' ";
sql_query($sql);
}
if($_POST['od_cp_id']) {
$sql = " update {$g4['shop_coupon_table']}
set od_id = '$od_id',
cp_used = '1',
cp_used_time = '".G4_TIME_YMDHIS."'
where cp_id = '{$_POST['od_cp_id']}'
and mb_id = '{$member['mb_id']}'
and cp_method = '2' ";
sql_query($sql);
}
if($_POST['sc_cp_id']) {
$sql = " update {$g4['shop_coupon_table']}
set od_id = '$od_id',
cp_used = '1',
cp_used_time = '".G4_TIME_YMDHIS."'
where cp_id = '{$_POST['sc_cp_id']}'
and mb_id = '{$member['mb_id']}'
and cp_method = '3' ";
sql_query($sql);
}
}
include_once(G4_SHOP_PATH.'/ordermail1.inc.php');
include_once(G4_SHOP_PATH.'/ordermail2.inc.php');

View File

@ -12,6 +12,7 @@ if (!defined("_ORDERINQUIRY_")) exit; // 개별 페이지 접근 불가
<th scope="col">주문번호</th>
<th scope="col">주문일시</th>
<th scope="col">주문금액</th>
<th scope="col">쿠폰</th>
<th scope="col">입금액</th>
</tr>
</thead>
@ -37,6 +38,7 @@ for ($i=0; $row=sql_fetch_array($result); $i++)
</td>
<td class="td_datetime"><?php echo substr($row['od_time'],0,16); ?> (<?php echo get_yoil($row['od_time']); ?>)</td>
<td class="td_bignum"><?php echo display_price($row['orderamount']); ?></td>
<td class="td_bignum"><?php echo display_price($row['couponamount']); ?></td>
<td class="td_stat"><?php echo display_price($row['receiptamount']); ?></td>
</tr>

View File

@ -44,7 +44,7 @@ include_once(G4_MSHOP_PATH.'/_head.php');
<dd>상품 배송이 완료되었습니다.</dd>
</dl>
<?php
$sql = " select it_id, it_name
$sql = " select it_id, it_name, cp_amount
from {$g4['shop_cart_table']}
where uq_id = '$uq_id'
and ct_num = '0'
@ -112,36 +112,63 @@ include_once(G4_MSHOP_PATH.'/_head.php');
</table>
</li>
<?php
$tot_cp_amount += $row['cp_amount'];
}
$send_cost = $od['od_send_cost'];
$send_coupon = $od['od_send_coupon'];
$org_send_cost = $send_cost + $send_coupon;
?>
</ul>
<?php
// 배송비가 0 보다 크다면 (있다면)
if ($send_cost > 0)
{
// 총계 = 주문상품금액합계 + 배송비 - 상품할인 - 결제할인
$od_coupon = $od['od_coupon'];
$tot_amount = $tot_sell_amount + $send_cost - $tot_cp_amount - $od_coupon;
?>
<div id="sod_bsk_dvr" class="sod_bsk_tot">
<span>배송비</span>
<strong><?php echo number_format($send_cost); ?> 원</strong>
<span>주문총액</span>
<strong><?php echo number_format($tot_sell_amount); ?> 원</strong>
</div>
<?php if($tot_cp_amount > 0) { ?>
<div id="sod_bsk_dvr" class="sod_bsk_tot">
<span>상품할인</span>
<strong><?php echo number_format($tot_cp_amount); ?> 원</strong>
</div>
<?php } ?>
<?php
// 총계 = 주문상품금액합계 + 배송비
$tot_amount = $tot_sell_amount + $send_cost;
if ($tot_amount > 0) {
?>
<?php if($od_coupon > 0) { ?>
<div id="sod_bsk_dvr" class="sod_bsk_tot">
<span>결제할인</span>
<strong><?php echo number_format($od_coupon); ?> 원</strong>
</div>
<?php } ?>
<?php if ($org_send_cost > 0) { ?>
<div id="sod_bsk_dvr" class="sod_bsk_tot">
<span>배송비</span>
<strong><?php echo number_format($org_send_cost); ?> 원</strong>
</div>
<?php } ?>
<?php if($send_coupon > 0) { ?>
<div id="sod_bsk_dvr" class="sod_bsk_tot">
<span>배송비할인</span>
<strong><?php echo number_format($send_coupon); ?> 원</strong>
</div>
<?php } ?>
<div id="sod_bsk_cnt" class="sod_bsk_tot">
<span>총계</span>
<strong><?php echo number_format($tot_amount); ?> 원 <?php echo number_format($tot_point); ?> 점</strong>
<strong><?php echo number_format($tot_amount); ?> 원</strong>
</div>
<?php } ?>
<div id="sod_bsk_cnt" class="sod_bsk_tot">
<span>포인트</span>
<strong><?php echo number_format($tot_point); ?> 점</strong>
</div>
</section>
<div id="sod_fin_view">

View File

@ -3,11 +3,12 @@ include_once('./_common.php');
$it_id = $_POST['it_id'];
$sql = " select it_id, it_option_subject, it_supply_subject
$sql = " select it_id, it_option_subject, it_supply_subject, it_price, it_point, it_point_type
from {$g4['shop_item_table']}
where it_id = '$it_id'
and it_use = '1' ";
$it = sql_fetch($sql);
$it_point = get_item_point($it);
if(!$it['it_id'])
die('no-item');
@ -18,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 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_point 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))
@ -30,6 +31,7 @@ if(!mysql_num_rows($result))
<input type="hidden" name="it_id" value="<?php echo $it['it_id']; ?>">
<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="total_price" value="">
<input type="hidden" name="sw_direct">
<?php

View File

@ -122,9 +122,6 @@ else if ($act == "optionmod") // 장바구니에서 옵션변경
if (!$_POST['it_id'])
alert('장바구니에 담을 상품을 선택하여 주십시오.');
// 기존 장바구니 자료를 먼저 삭제
sql_query(" delete from {$g4['shop_cart_table']} where uq_id = '$tmp_uq_id' and it_id = '$it_id' ");
$option_count = count($_POST['io_id']);
if($option_count) {
@ -171,7 +168,7 @@ else if ($act == "optionmod") // 장바구니에서 옵션변경
if ((int)$_POST['total_price'] !== (int)$total_price)
die("Error..");
$point = $it['it_point'];
$point = get_item_point($it);
// 포인트가 다름
if ((int)$point !== (int)$_POST['it_point'] && $config['cf_use_point'])
die("Error...");
@ -204,6 +201,9 @@ else if ($act == "optionmod") // 장바구니에서 옵션변경
}
//--------------------------------------------------------
// 기존 장바구니 자료를 먼저 삭제
sql_query(" delete from {$g4['shop_cart_table']} where uq_id = '$tmp_uq_id' and it_id = '$it_id' ");
// 포인트 사용하지 않는다면
if (!$config['cf_use_point']) { $_POST['it_point'] = 0; }

View File

@ -338,12 +338,7 @@ else
<th scope="row">포인트</th>
<td>
<?php
if($it['it_point_type']) {
$it_point = floor(($it['it_price'] * ($it['it_point'] / 100) / 10)) * 10;
} else {
$it_point = $it['it_point'];
}
$it_point = get_item_point($it);
echo number_format($it_point);
?> 점
<input type="hidden" name="it_point" value="<?php echo $it_point; ?>">

View File

@ -131,7 +131,6 @@ setTimeout("init_pay_button();",300);
<?php
$tot_point = 0;
$tot_sell_amount = 0;
$tot_cancel_amount = 0;
$goods = $goods_it_id = "";
$goods_count = -1;
@ -180,7 +179,7 @@ setTimeout("init_pay_button();",300);
$goods_count++;
// 에스크로 상품정보
if($s_page == 'orderform.php' && $default['de_escrow_use']) {
if($default['de_escrow_use']) {
if ($i>0)
$good_info .= chr(30);
$good_info .= "seq=".($i+1).chr(31);
@ -236,7 +235,7 @@ setTimeout("init_pay_button();",300);
<td class="td_num"><?php echo number_format($sum['qty']); ?></td>
<td class="td_bignum"><?php echo number_format($row['ct_price']); ?></td>
<td><?php echo $cp_button; ?></td>
<td class="td_bignum"><span id="sell_amount_<?php echo $i; ?>"><?php echo number_format($sell_amount); ?></span></td>
<td class="td_bignum"><span class="ct_sell_amount"><?php echo number_format($sell_amount); ?></span></td>
<td class="td_bignum"><?php echo number_format($point); ?></td>
</tr>
@ -905,19 +904,20 @@ setTimeout("init_pay_button();",300);
<script>
$(function() {
var item_index;
var $cp_btn_el;
var $cp_row_el;
$(".it_coupon_btn").click(function() {
var $this = $(this);
$cp_btn_el = $(this);
$cp_row_el = $(this).closest("tr");
$("#it_coupon_frm").remove();
item_index = $(".it_coupon_btn").index($this);
var it_id = $("input[name='it_id["+item_index+"]']").val();
var it_id = $cp_btn_el.closest("tr").find("input[name^=it_id]").val();
$.post(
"./orderitemcoupon.php",
{ it_id: it_id },
function(data) {
$this.after(data);
$cp_btn_el.after(data);
}
);
});
@ -938,12 +938,14 @@ $(function() {
// 이미 사용한 쿠폰이 있는지
var cp_dup = false;
var cp_dup_idx;
var $cp_dup_el;
$("input[name^=cp_id]").each(function(index) {
var id = $(this).val();
if(id == cp_id) {
cp_dup_idx = index;
cp_dup = true;
$cp_dup_el = $(this).closest("tr");;
return false;
}
@ -954,32 +956,32 @@ $(function() {
if(!confirm(subj+ "쿠폰은 "+it_name+"에 사용되었습니다.\n"+it_name+"의 쿠폰을 취소한 후 적용하시겠습니까?")) {
return false;
} else {
coupon_cancel(cp_dup_idx);
coupon_cancel($cp_dup_el);
}
}
var $s_el = $("#sell_amount_"+item_index);
sell_amount = parseInt($("input[name='it_amount["+item_index+"]']").val());
var $s_el = $cp_row_el.find(".ct_sell_amount");;
sell_amount = parseInt($cp_row_el.find("input[name^=it_amount]").val());
sell_amount = sell_amount - parseInt(amount);
$s_el.text(number_format(String(sell_amount)));
$("input[name='cp_id["+item_index+"]']").val(cp_id);
$("input[name='cp_amount["+item_index+"]']").val(amount);
$cp_row_el.find("input[name^=cp_id]").val(cp_id);
$cp_row_el.find("input[name^=cp_amount]").val(amount);
calculate_total_amount();
$("#it_coupon_frm").remove();
$(".it_coupon_btn").eq(item_index).focus();
$cp_btn_el.focus();
});
$("#it_coupon_close").live("click", function() {
$("#it_coupon_frm").remove();
$(".it_coupon_btn").eq(item_index).focus();
$cp_btn_el.focus();
});
$("#it_coupon_cancel").live("click", function() {
coupon_cancel(item_index);
coupon_cancel($cp_row_el);
calculate_total_amount();
$("#it_coupon_frm").remove();
$(".it_coupon_btn").eq(item_index).focus();
$cp_btn_el.focus();
});
$("#od_coupon_btn").click(function() {
@ -1090,15 +1092,15 @@ $(function() {
});
});
function coupon_cancel(idx)
function coupon_cancel($el)
{
var $dup_sell_el = $("#sell_amount_"+idx);
var $dup_amount_el = $("input[name='cp_amount["+idx+"]']");
var org_sell_amount = $("input[name='it_amount["+idx+"]']").val();
var $dup_sell_el = $el.find(".ct_sell_amount");
var $dup_amount_el = $el.find("input[name^=cp_amount]");
var org_sell_amount = $el.find("input[name^=it_amount]").val();
$dup_sell_el.text(number_format(String(org_sell_amount)));
$dup_amount_el.val(0);
$("input[name='cp_id["+idx+"]']").val("");
$el.find("input[name^=cp_id]").val("");
}
function calculate_total_amount()
@ -1244,8 +1246,9 @@ function forderform_check(f)
}
var tot_amount = <?php echo (int)$tot_amount; ?>;
var max_point = 0;
if (typeof(f.max_temp_point) != "undefined")
var max_point = parseInt(f.max_temp_point.value);
max_point = parseInt(f.max_temp_point.value);
var temp_point = 0;
if (typeof(f.od_temp_point) != "undefined") {
@ -1265,7 +1268,14 @@ function forderform_check(f)
return false;
}
if (temp_point > <?php echo (int)$member['mb_point']; ?>) {
<?php
if($default['de_mileage_use'])
$mb_point = $member['mb_mileage'];
else
$mb_point = $member['mb_point'];
?>
if (temp_point > <?php echo (int)$mb_point; ?>) {
alert("회원님의 포인트보다 많이 결제할 수 없습니다.");
f.od_temp_point.select();
return false;