#248 회원의 보유쿠폰 리스트

This commit is contained in:
chicpro
2013-07-04 10:59:49 +09:00
parent 90d56f7097
commit 061ad00cd9
3 changed files with 111 additions and 4 deletions

View File

@ -6,6 +6,15 @@ if (!$is_member)
$g4['title'] = '마이페이지';
include_once(G4_MSHOP_PATH.'/_head.php');
// 쿠폰
$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."' ";
$cp = sql_fetch($sql);
?>
<div id="smb_my">
@ -14,8 +23,6 @@ include_once(G4_MSHOP_PATH.'/_head.php');
<h2>회원정보 개요</h2>
<dl>
<dt>회원권한</dt>
<dd><?php echo $member['mb_level']; ?></dd>
<?php if($default['de_mileage_use']) { ?>
<dt>마일리지</dt>
<dd><a href="<?php echo G4_SHOP_URL; ?>/mileage.php" target="_blank" class="win_point"><?php echo number_format($member['mb_mileage']); ?>점</a></dd>
@ -23,6 +30,8 @@ include_once(G4_MSHOP_PATH.'/_head.php');
<dt>보유포인트</dt>
<dd><a href="<?php echo G4_BBS_URL; ?>/point.php" target="_blank" class="win_point"><?php echo number_format($member['mb_point']); ?>점</a></dd>
<?php } ?>
<dt>보유쿠폰</dt>
<dd><a href="<?php echo G4_SHOP_URL; ?>/coupon.php" target="_blank" class="win_coupon"><?php echo number_format($cp['cnt']); ?></a></dd>
<dt>연락처</dt>
<dd><?php echo ($member['mb_tel'] ? $member['mb_tel'] : '미등록'); ?></dd>
<dt>E-Mail</dt>
@ -92,6 +101,14 @@ include_once(G4_MSHOP_PATH.'/_head.php');
</div>
<script>
$(function() {
$(".win_coupon").click(function() {
var new_win = window.open($(this).attr("href"), "win_coupon", "left=100,top=100,width=700, height=600, scrollbars=1");
new_win.focus();
return false;
});
});
function member_leave()
{
return confirm('정말 회원에서 탈퇴 하시겠습니까?')

73
shop/coupon.php Normal file
View File

@ -0,0 +1,73 @@
<?php
include_once('./_common.php');
if ($is_guest)
alert_close('회원만 조회하실 수 있습니다.');
$g4['title'] = $member['mb_nick'].' 님의 마일리지 내역';
include_once(G4_PATH.'/head.sub.php');
$sql = " select cp_id, cp_subject, cp_method, cp_target, cp_start, cp_end, cp_type, cp_amount
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."'
order by cp_no ";
$result = sql_query($sql);
$count = @mysql_num_rows($result);
if(!$count)
alert_close('보유하신 쿠폰이 없습니다.');
?>
<div id="coupon" class="new_win">
<table class="basic_tbl">
<thead>
<tr>
<th scope="col">쿠폰명</th>
<th scope="col">적용대상</th>
<th scope="col">할인금액</th>
<th scope="col">사용기한</th>
</tr>
</thead>
<tbody>
<?php
for($i=0; $row=sql_fetch_array($result); $i++) {
if($row['cp_method'] == 1) {
$sql = " select ca_name from {$g4['shop_category_table']} where ca_id = '{$row['cp_target']}' ";
$ca = sql_fetch($sql);
$cp_target = $ca['ca_name'].'의 상품할인';
} else if($row['cp_method'] == 2) {
$cp_target = '결제금액 할인';
} else if($row['cp_method'] == 3) {
$cp_target = '배송비 할인';
} else {
$sql = " select it_name from {$g4['shop_item_table']} where it_id = '{$row['cp_target']}' ";
$it = sql_fetch($sql);
$cp_target = $it['it_name'].' 상품할인';
}
if($row['cp_type'])
$cp_amount = $row['cp_amount'].'%';
else
$cp_amount = number_format($row['cp_amount']).'원';
?>
<tr>
<td><?php echo $row['cp_subject']; ?></td>
<td><?php echo $cp_target; ?></td>
<td><?php echo $cp_amount; ?></td>
<td><?php echo substr($row['cp_start'], 2, 8); ?> ~ <?php echo substr($row['cp_end'], 2, 8); ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
<div class="btn_win"><a href="javascript:;" onclick="window.close();">창닫기</a></div>
</div>
<?php
include_once(G4_PATH.'/tail.sub.php');
?>

View File

@ -14,6 +14,15 @@ include_once('./_head.php');
//$str = $g4[title];
//include("./navigation2.inc.php");
// 쿠폰
$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."' ";
$cp = sql_fetch($sql);
?>
<!-- 마이페이지 시작 { -->
@ -33,8 +42,6 @@ include_once('./_head.php');
</div>
<dl>
<dt>회원권한</dt>
<dd><?php echo $member['mb_level']; ?></dd>
<?php if($default['de_mileage_use']) { ?>
<dt>마일리지</dt>
<dd><a href="<?php echo G4_SHOP_URL; ?>/mileage.php" target="_blank" class="win_point"><?php echo number_format($member['mb_mileage']); ?>점</a></dd>
@ -42,6 +49,8 @@ include_once('./_head.php');
<dt>보유포인트</dt>
<dd><a href="<?php echo G4_BBS_URL; ?>/point.php" target="_blank" class="win_point"><?php echo number_format($member['mb_point']); ?>점</a></dd>
<?php } ?>
<dt>보유쿠폰</dt>
<dd><a href="<?php echo G4_SHOP_URL; ?>/coupon.php" target="_blank" class="win_coupon"><?php echo number_format($cp['cnt']); ?></a></dd>
<dt>연락처</dt>
<dd><?php echo ($member['mb_tel'] ? $member['mb_tel'] : '미등록'); ?></dd>
<dt>E-Mail</dt>
@ -124,6 +133,14 @@ include_once('./_head.php');
</div>
<script>
$(function() {
$(".win_coupon").click(function() {
var new_win = window.open($(this).attr("href"), "win_coupon", "left=100,top=100,width=700, height=600, scrollbars=1");
new_win.focus();
return false;
});
});
function member_leave()
{
return confirm('정말 회원에서 탈퇴 하시겠습니까?')