#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

@ -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;