쿠폰존 추가

This commit is contained in:
chicpro
2016-09-09 13:57:57 +09:00
parent ac89a2d512
commit 6e1aa4ac0c
27 changed files with 1446 additions and 9 deletions

View File

@ -14,6 +14,7 @@ $menu['menu400'] = array (
array('400610', '상품유형관리', G5_ADMIN_URL.'/shop_admin/itemtypelist.php', 'scf_item_type'),
array('400500', '상품옵션재고관리', G5_ADMIN_URL.'/shop_admin/optionstocklist.php', 'scf_item_option'),
array('400800', '쿠폰관리', G5_ADMIN_URL.'/shop_admin/couponlist.php', 'scf_coupon'),
array('400810', '쿠폰존관리', G5_ADMIN_URL.'/shop_admin/couponzonelist.php', 'scf_coupon_zone'),
array('400750', '추가배송비관리', G5_ADMIN_URL.'/shop_admin/sendcostlist.php', 'scf_sendcost', 1),
array('400410', '미완료주문', G5_ADMIN_URL.'/shop_admin/inorderlist.php', 'scf_inorder', 1),
);

View File

@ -434,6 +434,7 @@ td.td_grpset {width:160px;border-left:1px solid #e9ecee;text-align:center}
.td_category3{width:80px;text-align:center}
.td_time{text-align:center;width:130px}
.td_center{text-align:center;}
.td_type{width:120px}
.txt_true {color:#e8180c}
.txt_false {color:#ccc}

View File

@ -21,5 +21,5 @@ for ($i=0; $i<$count; $i++)
sql_query($sql);
}
goto_url('./couponlist.php');
goto_url('./couponlist.php?'.$qstr);
?>

View File

@ -0,0 +1,305 @@
<?php
$sub_menu = '400810';
include_once('./_common.php');
auth_check($auth[$sub_menu], "w");
$g5['title'] = '쿠폰존 쿠폰관리';
if ($w == 'u') {
$html_title = '쿠폰 수정';
$sql = " select * from {$g5['g5_shop_coupon_zone_table']} where cz_id = '$cz_id' ";
$cp = sql_fetch($sql);
if (!$cp['cz_id']) alert('등록된 자료가 없습니다.');
}
else
{
$html_title = '쿠폰 입력';
$cp['cz_start'] = G5_TIME_YMD;
$cp['cz_end'] = date('Y-m-d', (G5_SERVER_TIME + 86400 * 15));
$cp['cz_period'] = 15;
}
if($cp['cp_method'] == 1) {
$cp_target_label = '적용분류';
$cp_target_btn = '분류검색';
} else {
$cp_target_label = '적용상품';
$cp_target_btn = '상품검색';
}
include_once (G5_ADMIN_PATH.'/admin.head.php');
include_once(G5_PLUGIN_PATH.'/jquery-ui/datepicker.php');
?>
<form name="fcouponform" action="./couponzoneformupdate.php" method="post" enctype="multipart/form-data" onsubmit="return form_check(this);">
<input type="hidden" name="w" value="<?php echo $w; ?>">
<input type="hidden" name="cz_id" value="<?php echo $cz_id; ?>">
<input type="hidden" name="stx" value="<?php echo $stx; ?>">
<input type="hidden" name="page" value="<?php echo $page;?>">
<div class="tbl_frm01 tbl_wrap">
<table>
<caption><?php echo $g5['title']; ?></caption>
<colgroup>
<col class="grid_4">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row"><label for="cz_type">발행쿠폰타입</label></th>
<td>
<?php echo help("발행 쿠폰의 타입을 설정합니다.<br>포인트쿠폰은 회원의 포인트를 쿠폰으로 교환하는 쿠폰이며 다운로드 쿠폰은 회원이 다운로드하여 사용할 수 있는 쿠폰입니다."); ?>
<select name="cz_type" id="cz_type">
<option value="0"<?php echo get_selected('0', $cp['cz_type']); ?>>다운로드쿠폰</option>
<option value="1"<?php echo get_selected('1', $cp['cz_type']); ?>>포인트쿠폰</option>
</select>
</td>
</tr>
<tr>
<th scope="row"><label for="cz_subject">쿠폰이름</label></th>
<td>
<input type="text" name="cz_subject" value="<?php echo get_text($cp['cz_subject']); ?>" id="cz_subject" required class="required frm_input" size="50">
</td>
</tr>
<tr>
<th scope="row"><label for="cz_start">사용시작일</label></th>
<td>
<?php echo help('입력 예: '.date('Y-m-d')); ?>
<input type="text" name="cz_start" value="<?php echo stripslashes($cp['cz_start']); ?>" id="cz_start" required class="frm_input required">
</td>
</tr>
<tr>
<th scope="row"><label for="cz_end">사용종료일</label></th>
<td>
<?php echo help('입력 예: '.date('Y-m-d')); ?>
<input type="text" name="cz_end" value="<?php echo stripslashes($cp['cz_end']); ?>" id="cz_end" required class="frm_input required">
</td>
</tr>
<tr id="tr_cz_point">
<th scope="row"><label for="cz_point">쿠폰교환 포인트</label></th>
<td>
<?php echo help("쿠폰으로 교환할 회원의 포인트를 지정합니다. 쿠폰 다운로드 때 설정한 값만큼 회원의 포인트를 차감합니다."); ?>
<input type="text" name="cz_point" value="<?php echo get_text($cp['cz_point']); ?>" id="cz_point" class="frm_input">
</td>
</tr>
<tr>
<th scope="row"><label for="cz_period">쿠폰사용기한</label></th>
<td>
<?php echo help("쿠폰 다운로드 후 사용할 수 있는 기간을 설정합니다."); ?>
<input type="text" name="cz_period" value="<?php echo stripslashes($cp['cz_period']); ?>" id="cz_period" required class="frm_input required" size="5"> 일
</td>
</tr>
<tr>
<th scope="row">쿠폰이미지</th>
<td>
<input type="file" name="cp_img">
<?php
$cpimg_str = '';
$cpimg = G5_DATA_PATH."/coupon/{$cp['cz_file']}";
if (is_file($cpimg) && $cp['cz_id']) {
$size = @getimagesize($cpimg);
if($size[0] && $size[0] > 750)
$width = 750;
else
$width = $size[0];
echo '<input type="checkbox" name="cp_img_del" value="1" id="cp_img_del"> <label for="cp_img_del">삭제</label>';
$cpimg_str = '<img src="'.G5_DATA_URL.'/coupon/'.$cp['cz_file'].'" width="'.$width.'">';
}
if ($cpimg_str) {
echo '<div class="coupon_img">';
echo $cpimg_str;
echo '</div>';
}
?>
</td>
</tr>
<tr>
<th scope="row"><label for="cp_method">발급쿠폰종류</label></th>
<td>
<select name="cp_method" id="cp_method">
<option value="0"<?php echo get_selected('0', $cp['cp_method']); ?>>개별상품할인</option>
<option value="1"<?php echo get_selected('1', $cp['cp_method']); ?>>카테고리할인</option>
<option value="2"<?php echo get_selected('2', $cp['cp_method']); ?>>주문금액할인</option>
<option value="3"<?php echo get_selected('3', $cp['cp_method']); ?>>배송비할인</option>
</select>
</td>
</tr>
<tr id="tr_cp_target">
<th scope="row"><label for="cp_target"><?php echo $cp_target_label; ?></label></th>
<td>
<input type="text" name="cp_target" value="<?php echo stripslashes($cp['cp_target']); ?>" id="cp_target" required class="required frm_input">
<button type="button" id="sch_target" class="btn_frmline"><?php echo $cp_target_btn; ?></button>
</td>
</tr>
<tr>
<th scope="row"><label for="cp_type">할인금액타입</label></th>
<td>
<select name="cp_type" id="cp_type">
<option value="0"<?php echo get_selected('0', $cp['cp_type']); ?>>정액할인(원)</option>
<option value="1"<?php echo get_selected('1', $cp['cp_type']); ?>>정률할인(%)</option>
</select>
</td>
</tr>
<tr>
<th scope="row"><label for="cp_price"><?php echo $cp['cp_type'] ? '할인비율' : '할인금액'; ?></label></th>
<td>
<input type="text" name="cp_price" value="<?php echo stripslashes($cp['cp_price']); ?>" id="cp_price" required class="frm_input required"> <span id="cp_price_unit"><?php echo $cp['cp_type'] ? '%' : '원'; ?></span>
</td>
</tr>
<tr id="tr_cp_trunc">
<th scope="row"><label for="cp_trunc">절사금액</label></th>
<td>
<select name="cp_trunc" id="cp_trunc">
<option value="1"<?php echo get_selected('1', $cp['cp_trunc']); ?>>1원단위</option>
<option value="10"<?php echo get_selected('10', $cp['cp_trunc']); ?>>10원단위</option>
<option value="100"<?php echo get_selected('100', $cp['cp_trunc']); ?>>100원단위</option>
<option value="1000"<?php echo get_selected('1000', $cp['cp_trunc']); ?>>1,000원단위</option>
</select>
</td>
</tr>
<tr>
<th scope="row"><label for="cp_minimum">최소주문금액</label></th>
<td>
<input type="text" name="cp_minimum" value="<?php echo stripslashes($cp['cp_minimum']); ?>" id="cp_minimum" class="frm_input"> 원
</td>
</tr>
<tr id="tr_cp_maximum">
<th scope="row"><label for="cp_maximum">최대할인금액</label></th>
<td>
<input type="text" name="cp_maximum" value="<?php echo stripslashes($cp['cp_maximum']); ?>" id="cp_maximum" class="frm_input"> 원
</td>
</tr>
</tbody>
</table>
</div>
<div class="btn_confirm01 btn_confirm">
<input type="submit" value="확인" class="btn_submit" accesskey="s">
<a href="./couponzonelist.php?<?php echo $qstr; ?>">목록</a>
</div>
</form>
<script>
$(function() {
<?php if(!$cp['cz_type']) { ?>
$("#tr_cz_point").hide();
<?php } ?>
<?php if($cp['cp_method'] == 2 || $cp['cp_method'] == 3) { ?>
$("#tr_cp_target").hide();
$("#tr_cp_target").find("input").attr("required", false).removeClass("required");
<?php } ?>
<?php if($cp['cp_type'] != 1) { ?>
$("#tr_cp_maximum").hide();
$("#tr_cp_trunc").hide();
<?php } ?>
$("#cz_type").change(function() {
if($(this).val() == "1") {
$("#tr_cz_point").find("input").attr("required", true).addClass("required");
$("#tr_cz_point").show();
} else {
$("#tr_cz_point").find("input").attr("required", false).removeClass("required");
$("#tr_cz_point").hide();
}
});
$("#cp_method").change(function() {
var cp_method = $(this).val();
change_method(cp_method);
});
$("#cp_type").change(function() {
var cp_type = $(this).val();
change_type(cp_type);
});
$("#sch_target").click(function() {
var cp_method = $("#cp_method").val();
var opt = "left=50,top=50,width=520,height=600,scrollbars=1";
var url = "./coupontarget.php?sch_target=";
if(cp_method == "0") {
window.open(url+"0", "win_target", opt);
} else if(cp_method == "1") {
window.open(url+"1", "win_target", opt);
} else {
return false;
}
});
$("#cz_start, #cz_end").datepicker(
{ changeMonth: true, changeYear: true, dateFormat: "yy-mm-dd", showButtonPanel: true, yearRange: "c-99:c+99" }
);
});
function change_method(cp_method)
{
if(cp_method == "0") {
$("#sch_target").text("상품검색");
$("#tr_cp_target").find("label").text("적용상품");
$("#tr_cp_target").find("input").attr("required", true).addClass("required");
$("#tr_cp_target").show();
} else if(cp_method == "1") {
$("#sch_target").text("분류검색");
$("#tr_cp_target").find("label").text("적용분류");
$("#tr_cp_target").find("input").attr("required", true).addClass("required");
$("#tr_cp_target").show();
} else {
$("#tr_cp_target").hide();
$("#tr_cp_target").find("input").attr("required", false).removeClass("required");
}
}
function change_type(cp_type)
{
if(cp_type == "0") {
$("#cp_price_unit").text("원");
$("#cp_price_unit").closest("tr").find("label").text("할인금액");
$("#tr_cp_maximum").hide();
$("#tr_cp_trunc").hide();
} else {
$("#cp_price_unit").text("%");
$("#cp_price_unit").closest("tr").find("label").text("할인비율");
$("#tr_cp_maximum").show();
$("#tr_cp_trunc").show();
}
}
function form_check(f)
{
var sel_type = f.cp_type;
var cp_type = sel_type.options[sel_type.selectedIndex].value;
var cp_price = f.cp_price.value;
<?php if(!$cpimg_str) { ?>
if(f.cp_img.value == "") {
alert("쿠폰이미지를 업로드해 주십시오.");
return false;
}
<?php } ?>
if(isNaN(cp_price)) {
if(cp_type == "1")
alert("할인비율을 숫자로 입력해 주십시오.");
else
alert("할인금액을 숫자로 입력해 주십시오.");
return false;
}
cp_price = parseInt(cp_price);
if(cp_type == "1" && (cp_price < 1 || cp_price > 99)) {
alert("할인비율을 1과 99 사이의 숫자로 입력해 주십시오.");
return false;
}
return true;
}
</script>
<?php
include_once (G5_ADMIN_PATH.'/admin.tail.php');
?>

View File

@ -0,0 +1,119 @@
<?php
$sub_menu = '400810';
include_once('./_common.php');
auth_check($auth[$sub_menu], "w");
check_admin_token();
@mkdir(G5_DATA_PATH."/coupon", G5_DIR_PERMISSION);
@chmod(G5_DATA_PATH."/coupon", G5_DIR_PERMISSION);
$_POST = array_map('trim', $_POST);
if(!$_POST['cz_subject'])
alert('쿠폰이름을 입력해 주십시오.');
if(!$_POST['cz_start'] || !$_POST['cz_end'])
alert('사용 시작일과 종료일을 입력해 주십시오.');
if($_POST['cz_start'] > $_POST['cz_end'])
alert('사용 시작일은 종료일 이전으로 입력해 주십시오.');
if($_POST['cz_end'] < G5_TIME_YMD)
alert('종료일은 오늘('.G5_TIME_YMD.')이후로 입력해 주십시오.');
if($_POST['cz_type'] && !$_POST['cz_point'])
alert('쿠폰교환 포인트를 입력해 주십시오.');
if(!$_POST['cz_period'])
alert('쿠폰사용기한을 입력해 주십시오.');
if($_POST['cp_method'] == 0 && !$_POST['cp_target'])
alert('적용상품을 입력해 주십시오.');
if($_POST['cp_method'] == 1 && !$_POST['cp_target'])
alert('적용분류를 입력해 주십시오.');
if(!$_POST['cp_price']) {
if($_POST['cp_type'])
alert('할인비율을 입력해 주십시오.');
else
alert('할인금액을 입력해 주십시오.');
}
if($_POST['cp_type'] && ($_POST['cp_price'] < 1 || $_POST['cp_price'] > 99))
alert('할인비율을은 1과 99사이 값으로 입력해 주십시오.');
if($_POST['cp_method'] == 0) {
$sql = " select count(*) as cnt from {$g5['g5_shop_item_table']} where it_id = '$cp_target' and it_nocoupon = '0' ";
$row = sql_fetch($sql);
if(!$row['cnt'])
alert('입력하신 상품코드는 존재하지 않는 코드이거나 쿠폰적용안함으로 설정된 상품입니다.');
} else if($_POST['cp_method'] == 1) {
$sql = " select count(*) as cnt from {$g5['g5_shop_category_table']} where ca_id = '$cp_target' and ca_nocoupon = '0' ";
$row = sql_fetch($sql);
if(!$row['cnt'])
alert('입력하신 분류코드는 존재하지 않는 분류코드이거나 쿠폰적용안함으로 설정된 분류입니다.');
}
$sql_common = " cz_subject = '{$_POST['cz_subject']}',
cz_type = '{$_POST['cz_type']}',
cz_start = '{$_POST['cz_start']}',
cz_end = '{$_POST['cz_end']}',
cz_period = '{$_POST['cz_period']}',
cz_point = '{$_POST['cz_point']}',
cp_method = '{$_POST['cp_method']}',
cp_target = '{$_POST['cp_target']}',
cp_price = '{$_POST['cp_price']}',
cp_type = '{$_POST['cp_type']}',
cp_trunc = '{$_POST['cp_trunc']}',
cp_minimum = '{$_POST['cp_minimum']}',
cp_maximum = '{$_POST['cp_maximum']}' ";
if($w == '') {
if(!$_FILES['cp_img']['name'])
alert('쿠폰이미지를 업로드해 주십시오.');
$sql = " INSERT INTO {$g5['g5_shop_coupon_zone_table']}
set $sql_common,
cz_datetime = '".G5_TIME_YMDHIS."' ";
sql_query($sql, true);
$cz_id = sql_insert_id();
} else if($w == 'u') {
$sql = " select * from {$g5['g5_shop_coupon_zone_table']} where cz_id = '$cz_id' ";
$cp = sql_fetch($sql);
if(!$cp['cz_id'])
alert('쿠폰정보가 존해하지 않습니다.', './couponzonelist.php');
if ($_POST['cp_img_del'] && $cp['cz_file']) {
@unlink(G5_DATA_PATH."/coupon/{$cp['cz_file']}");
$cp['cz_file'] = '';
}
if(!$cp['cz_file'] && !$_FILES['cp_img']['name'])
alert('쿠폰이미지를 업로드해 주십시오.');
$sql = " update {$g5['g5_shop_coupon_zone_table']}
set $sql_common
where cz_id = '$cz_id' ";
sql_query($sql);
}
// 이미지업로드
if($_FILES['cp_img']['tmp_name']) {
preg_match('#.+\.([a-z]+)$#', $_FILES['cp_img']['name'], $m);
$filename = date('YmdHis').(microtime(true) * 10000).'.'.strtolower($m[1]);
upload_file($_FILES['cp_img']['tmp_name'], $filename, G5_DATA_PATH."/coupon");
$sql = " update {$g5['g5_shop_coupon_zone_table']}
set cz_file = '$filename'
where cz_id = '$cz_id' ";
sql_query($sql);
}
goto_url('./couponzonelist.php?'.$qstr);
?>

View File

@ -0,0 +1,180 @@
<?php
$sub_menu = '400810';
include_once('./_common.php');
auth_check($auth[$sub_menu], "r");
$sql_common = " from {$g5['g5_shop_coupon_zone_table']} ";
$sql_search = " where (1) ";
if ($stx) {
$sql_search .= " and cp_subject like '%$stx%' ";
}
if (!$sst) {
$sst = "cz_id";
$sod = "desc";
}
$sql_order = " order by {$sst} {$sod} ";
$sql = " select count(*) as cnt
{$sql_common}
{$sql_search}
{$sql_order} ";
$row = sql_fetch($sql);
$total_count = $row['cnt'];
$rows = $config['cf_page_rows'];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page < 1) $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
$sql = " select *
{$sql_common}
{$sql_search}
{$sql_order}
limit {$from_record}, {$rows} ";
$result = sql_query($sql);
$g5['title'] = '쿠폰존관리';
include_once (G5_ADMIN_PATH.'/admin.head.php');
$colspan = 9;
?>
<form name="fsearch" id="fsearch" class="local_sch01 local_sch" method="get">
<span>
전체 <?php echo number_format($total_count) ?> 개
</span>
<label for="stx" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
<input type="text" name="stx" value="<?php echo $stx ?>" id="stx" required class="required frm_input">
<input type="submit" class="btn_submit" value="검색">
</form>
<div class="btn_add01 btn_add">
<a href="./couponzoneform.php" id="coupon_add">쿠폰 추가</a>
</div>
<form name="fcouponlist" id="fcouponzonelist" method="post" action="./couponzonelist_delete.php" onsubmit="return fcouponzonelist_submit(this);">
<input type="hidden" name="stx" value="<?php echo $stx; ?>">
<input type="hidden" name="page" value="<?php echo $page; ?>">
<input type="hidden" name="token" value="">
<div class="tbl_head01 tbl_wrap">
<table>
<caption><?php echo $g5['title']; ?></caption>
<thead>
<tr>
<th scope="col">
<label for="chkall" class="sound_only">쿠폰 전체</label>
<input type="checkbox" name="chkall" value="1" id="chkall" onclick="check_all(this.form)">
</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">사용기한</th>
<th scope="col">관리</th>
</tr>
</thead>
<tbody>
<?php
for ($i=0; $row=sql_fetch_array($result); $i++) {
switch($row['cz_type']) {
case '1':
$cz_type = '포인트쿠폰';
break;
default:
$cz_type = '다운로드쿠폰';
break;
}
switch($row['cp_method']) {
case '0':
$sql3 = " select it_name from {$g5['g5_shop_item_table']} where it_id = '{$row['cp_target']}' ";
$row3 = sql_fetch($sql3);
$cp_method = '개별상품할인';
$cp_target = get_text($row3['it_name']);
break;
case '1':
$sql3 = " select ca_name from {$g5['g5_shop_category_table']} where ca_id = '{$row['cp_target']}' ";
$row3 = sql_fetch($sql3);
$cp_method = '카테고리할인';
$cp_target = get_text($row3['ca_name']);
break;
case '2':
$cp_method = '주문금액할인';
$cp_target = '주문금액';
break;
case '3':
$cp_method = '배송비할인';
$cp_target = '배송비';
break;
}
if($row['cp_type'])
$cp_price = $row['cp_price'].'%';
else
$cp_price = number_format($row['cp_price']).'원';
$bg = 'bg'.($i%2);
?>
<tr class="<?php echo $bg; ?>">
<td class="td_chk">
<input type="hidden" id="cz_id_<?php echo $i; ?>" name="cz_id[<?php echo $i; ?>]" value="<?php echo $row['cz_id']; ?>">
<input type="checkbox" id="chk_<?php echo $i; ?>" name="chk[]" value="<?php echo $i; ?>" title="내역선택">
</td>
<td><?php echo get_text($row['cz_subject']); ?></td>
<td class="td_type"><?php echo $cz_type; ?></td>
<td class="td_type"><?php echo $cp_method; ?></td>
<td class="td_odrnum2"><?php echo $cp_price; ?></td>
<td class="td_type">다운로드 후 <?php echo $row['cz_period']; ?>일</td>
<td class="td_num"><?php echo number_format($row['cz_download']); ?></td>
<td class="td_datetime"><?php echo substr($row['cz_start'], 2, 8); ?> ~ <?php echo substr($row['cz_end'], 2, 8); ?></td>
<td class="td_mngsmall">
<a href="./couponzoneform.php?w=u&amp;cz_id=<?php echo $row['cz_id']; ?>&amp;<?php echo $qstr; ?>"><span class="sound_only"><?php echo get_text($row['cz_subject']); ?> </span>수정</a>
</td>
</tr>
<?php
}
if ($i == 0)
echo '<tr><td colspan="'.$colspan.'" class="empty_table">자료가 없습니다.</td></tr>';
?>
</tbody>
</table>
</div>
<div class="btn_list01 btn_list">
<input type="submit" name="act_button" value="선택삭제" onclick="document.pressed=this.value">
</div>
</form>
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['SCRIPT_NAME']}?$qstr&amp;page="); ?>
<script>
function fcouponzonelist_submit(f)
{
if (!is_checked("chk[]")) {
alert(document.pressed+" 하실 항목을 하나 이상 선택하세요.");
return false;
}
if(document.pressed == "선택삭제") {
if(!confirm("선택한 자료를 정말 삭제하시겠습니까?")) {
return false;
}
}
return true;
}
</script>
<?php
include_once (G5_ADMIN_PATH.'/admin.tail.php');
?>

View File

@ -0,0 +1,25 @@
<?php
$sub_menu = '400810';
include_once('./_common.php');
check_demo();
auth_check($auth[$sub_menu], 'd');
check_admin_token();
$count = count($_POST['chk']);
if(!$count)
alert('선택삭제 하실 항목을 하나이상 선택해 주세요.');
for ($i=0; $i<$count; $i++)
{
// 실제 번호를 넘김
$k = $_POST['chk'][$i];
$sql = " delete from {$g5['g5_shop_coupon_zone_table']} where cz_id = '{$_POST['cz_id'][$k]}' ";
sql_query($sql);
}
goto_url('./couponzonelist.php?'.$qstr);
?>

View File

@ -35,7 +35,7 @@ ul,li{list-style:none;padding:0;margin:0;}
#hd_tnb{margin-top:-1px}
#hd_tnb:after {display:block;visibility:hidden;clear:both;content:""}
#hd_tnb li{float:left;width:25%;}
#hd_tnb li{float:left;width:20%;}
#hd_tnb li a{display:block;color:#a8a8a8;background:#f9f9f9;border:1px solid #e9e9e9;border-right:none;height:30px;line-height:30px;font-size:0.92em}
#hd_tnb li a:hover{background:#f1f1f1}
#hd_tnb li:first-child a{border-left:none}

View File

@ -139,6 +139,7 @@ CREATE TABLE IF NOT EXISTS `g5_shop_coupon` (
`cp_method` TINYINT(4) NOT NULL DEFAULT '0',
`cp_target` VARCHAR(255) NOT NULL DEFAULT '',
`mb_id` VARCHAR(255) NOT NULL DEFAULT '',
`cz_id` int(11) NOT NULL DEFAULT '0',
`cp_start` DATE NOT NULL DEFAULT '0000-00-00',
`cp_end` DATE NOT NULL DEFAULT '0000-00-00',
`cp_price` INT(11) NOT NULL DEFAULT '0',
@ -174,6 +175,34 @@ CREATE TABLE IF NOT EXISTS `g5_shop_coupon_log` (
-- --------------------------------------------------------
--
-- Table structure for table `g5_shop_coupon_zone`
--
DROP TABLE IF EXISTS `g5_shop_coupon_zone`;
CREATE TABLE IF NOT EXISTS `g5_shop_coupon_zone` (
`cz_id` int(11) NOT NULL AUTO_INCREMENT,
`cz_type` tinyint(4) NOT NULL DEFAULT '0',
`cz_subject` varchar(255) NOT NULL DEFAULT '',
`cz_start` DATE NOT NULL DEFAULT '0000-00-00',
`cz_end` DATE NOT NULL DEFAULT '0000-00-00',
`cz_file` varchar(255) NOT NULL DEFAULT '',
`cz_period` int(11) NOT NULL DEFAULT '0',
`cz_point` INT(11) NOT NULL DEFAULT '0',
`cp_method` TINYINT(4) NOT NULL DEFAULT '0',
`cp_target` VARCHAR(255) NOT NULL DEFAULT '',
`cp_price` INT(11) NOT NULL DEFAULT '0',
`cp_type` TINYINT(4) NOT NULL DEFAULT '0',
`cp_trunc` INT(11) NOT NULL DEFAULT '0',
`cp_minimum` INT(11) NOT NULL DEFAULT '0',
`cp_maximum` INT(11) NOT NULL DEFAULT '0',
`cz_download` int(11) NOT NULL DEFAULT '0',
`cz_datetime` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`cz_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `g5_shop_default`
--

37
js/shop.couponzone.js Normal file
View File

@ -0,0 +1,37 @@
$(function() {
$("button.coupon_download").on("click", function() {
if(g5_is_member != "1") {
alert("회원 로그인 후 이용해 주십시오.");
return false;
}
var $this = $(this);
var cz_id = $this.data("cid");
if($this.hasClass("disabled")) {
alert("이미 다운로드하신 쿠폰입니다.");
return false;
}
$this.addClass("disabled").attr("disabled", true);
$.ajax({
type: "GET",
data: { cz_id: cz_id },
url: g5_url+"/shop/ajax.coupondownload.php",
cache: false,
async: true,
dataType: "json",
success: function(data) {
if(data.error != "") {
$this.removeClass("disabled").attr("disabled", false);
alert(data.error);
return false;
}
$this.attr("disabled", false);
alert("쿠폰이 발급됐습니다.");
}
});
});
});

View File

@ -2220,6 +2220,21 @@ function make_order_field($data, $exclude)
return $field;
}
// 다운로드한 쿠폰인지
function is_coupon_downloaded($mb_id, $cz_id)
{
global $g5;
if(!$mb_id)
return false;
$sql = " select count(*) as cnt from {$g5['g5_shop_coupon_table']} where mb_id = '$mb_id' and cz_id = '$cz_id' ";
$row = sql_fetch($sql);
return ($row['cnt'] > 0);
}
//==============================================================================
// 쇼핑몰 라이브러리 모음 끝
//==============================================================================

View File

@ -33,9 +33,9 @@ include_once(G5_LIB_PATH.'/latest.lib.php');
<?php } else { ?>
<li><a href="<?php echo G5_BBS_URL; ?>/login.php?url=<?php echo $urlencode; ?>">LOGIN</a></li>
<li><a href="<?php echo G5_BBS_URL ?>/register.php" id="snb_join">JOIN</a></li>
<?php } ?>
<li><a href="<?php echo G5_SHOP_URL; ?>/mypage.php">MY PAGE</a></li>
<li><a href="<?php echo G5_SHOP_URL; ?>/couponzone.php">쿠폰존</a></li>
<li><a href="<?php echo G5_SHOP_URL; ?>/cart.php" class="tnb_cart"><span></span>CART</a></li>

View File

@ -0,0 +1,127 @@
<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.G5_SHOP_CSS_URL.'/style.css">', 0);
?>
<section class="couponzone_list">
<h2>다운로드 쿠폰</h2>
<p><?php echo $default['de_admin_company_name']; ?> 회원이시라면 쿠폰 다운로드 후 바로 사용하실 수 있습니다.</p>
<?php
$sql = " select * $sql_common and cz_type = '0' $sql_order ";
$result = sql_query($sql);
$coupon = '';
for($i=0; $row=sql_fetch_array($result); $i++) {
if(!$row['cz_file'])
continue;
$img_file = G5_DATA_PATH.'/coupon/'.$row['cz_file'];
if(!is_file($img_file))
continue;
$subj = get_text($row['cz_subject']);
switch($row['cp_method']) {
case '0':
$sql3 = " select it_id, it_name from {$g5['g5_shop_item_table']} where it_id = '{$row['cp_target']}' ";
$row3 = sql_fetch($sql3);
$cp_target = '<a href="./item.php?it_id='.$row3['it_id'].'">'.get_text($row3['it_name']).'</a>';
break;
case '1':
$sql3 = " select ca_id, ca_name from {$g5['g5_shop_category_table']} where ca_id = '{$row['cp_target']}' ";
$row3 = sql_fetch($sql3);
$cp_target = '<a href="./list.php?ca_id='.$row3['ca_id'].'">'.get_text($row3['ca_name']).'</a>';
break;
case '2':
$cp_target = '주문금액할인';
break;
case '3':
$cp_target = '배송비할인';
break;
}
// 다운로드 쿠폰인지
$disabled = '';
if(is_coupon_downloaded($member['mb_id'], $row['cz_id']))
$disabled = ' disabled';
$coupon .= '<li><div class="coupon_wr">'.PHP_EOL;
$coupon .= '<div class="coupon_img"><img src="'.str_replace(G5_PATH, G5_URL, $img_file).'" alt="'.$subj.'"></div>'.PHP_EOL;
$coupon .= '<div class="coupon_tit">'.$subj.'</div>'.PHP_EOL;
$coupon .= '<div class="coupon_date">기한 : 다운로드 후 '.number_format($row['cz_period']).'일</div>'.PHP_EOL;
$coupon .= '<div class="coupon_target">적용 : '.$cp_target.'</div>'.PHP_EOL;
$coupon .= '<div class="coupon_btn"><button type="button" class="coupon_download btn02'.$disabled.'" data-cid="'.$row['cz_id'].'">쿠폰다운로드</button></div>'.PHP_EOL;
$coupon .= '</div></li>'.PHP_EOL;
}
if($coupon)
echo '<ul>'.PHP_EOL.$coupon.'</ul>'.PHP_EOL;
else
echo '<p class="no_coupon">사용할 수 있는 쿠폰이 없습니다.</p>';
?>
</section>
<section class="couponzone_list" id="point_coupon">
<h2>포인트 쿠폰</h2>
<p>보유하신 <?php echo $default['de_admin_company_name']; ?> 회원 포인트를 쿠폰으로 교환하실 수 있습니다.</p>
<?php
$sql = " select * $sql_common and cz_type = '1' $sql_order ";
$result = sql_query($sql);
$coupon = '';
for($i=0; $row=sql_fetch_array($result); $i++) {
if(!$row['cz_file'])
continue;
$img_file = G5_DATA_PATH.'/coupon/'.$row['cz_file'];
if(!is_file($img_file))
continue;
$subj = get_text($row['cz_subject']);
switch($row['cp_method']) {
case '0':
$sql3 = " select it_id, it_name from {$g5['g5_shop_item_table']} where it_id = '{$row['cp_target']}' ";
$row3 = sql_fetch($sql3);
$cp_target = '<a href="./item.php?it_id='.$row3['it_id'].'">'.get_text($row3['it_name']).'</a>';
break;
case '1':
$sql3 = " select ca_id, ca_name from {$g5['g5_shop_category_table']} where ca_id = '{$row['cp_target']}' ";
$row3 = sql_fetch($sql3);
$cp_target = '<a href="./list.php?ca_id='.$row3['ca_id'].'">'.get_text($row3['ca_name']).'</a>';
break;
case '2':
$cp_target = '주문금액할인';
break;
case '3':
$cp_target = '배송비할인';
break;
}
// 다운로드 쿠폰인지
$disabled = '';
if(is_coupon_downloaded($member['mb_id'], $row['cz_id']))
$disabled = ' disabled';
$coupon .= '<li><div class="coupon_wr">'.PHP_EOL;
$coupon .= '<div class="coupon_img"><img src="'.str_replace(G5_PATH, G5_URL, $img_file).'" alt="'.$subj.'"></div>'.PHP_EOL;
$coupon .= '<div class="coupon_tit">'.$subj.'</div>'.PHP_EOL;
$coupon .= '<div class="coupon_date">기한 : 다운로드 후 '.number_format($row['cz_period']).'일</div>'.PHP_EOL;
$coupon .= '<div class="coupon_target">적용 : '.$cp_target.'</div>'.PHP_EOL;
$coupon .= '<div class="coupon_point">포인트 '.number_format($row['cz_point']).'점 차감</div>'.PHP_EOL;
$coupon .= '<div class="coupon_btn"><button type="button" class="coupon_download btn02'.$disabled.'" data-cid="'.$row['cz_id'].'">쿠폰다운로드</button></div>'.PHP_EOL;
$coupon .= '</div></li>'.PHP_EOL;
}
if($coupon)
echo '<ul>'.PHP_EOL.$coupon.'</ul>'.PHP_EOL;
else
echo '<p class="no_coupon">사용할 수 있는 쿠폰이 없습니다.</p>';
?>
</section>

View File

@ -315,4 +315,25 @@ a.qa_wr{padding:10px 0;display:block;width:100%;text-align:center;background:#34
#fancyalert_inner button {margin:15px 0 0;padding:10px 30px;border:0;background:#000;color:#fff}
#fancyalert_bg {z-index:0;position:absolute;top:0;left:0;width:100%;height:100%;vertical-align:middle;background:#000;text-align:center;opacity: 0.7}
#sit_sms_new .tbl_frm01 th {width:100px}
#sit_sms_new .tbl_frm01 th {width:100px}
/*쿠폰존 리스트*/
.couponzone_list{margin:0 0 50px;}
.couponzone_list h2{margin:10px 10px 5px}
.couponzone_list p{margin:0 10px 5px;}
.couponzone_list ul{padding:0 5px;margin:0;list-style:none}
.couponzone_list ul:after {display:block;visibility:hidden;clear:both;content:""}
.couponzone_list ul li{float:left;width:48%;height:210px;padding:0 1% 15px;}
.couponzone_list ul li .coupon_wr{border:1px solid #e9e9e9;background:#f2f6f9;line-height:1.2em;}
.couponzone_list ul li img{width:100%;height:100%}
.couponzone_list ul li .coupon_img{height:100px;overflow:hidden;border-bottom:1px solid #e9e9e9}
.couponzone_list ul li .coupon_tit{margin:10px 10px 5px;font-weight:bold;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;}
.couponzone_list ul li .coupon_date{margin: 5px 10px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;}
.couponzone_list ul li .coupon_target{margin: 5px 10px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;}
.couponzone_list ul li .coupon_point{margin: 5px 10px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;}
.couponzone_list ul li .coupon_btn{margin:10px;text-align:center}
.couponzone_list ul li .coupon_btn .btn02{width:70%;padding:7px 0;background:#ec2037;border-color:#c92033}
.couponzone_list ul li .coupon_btn .disabled {background: #ddd;border:1px;color:#999;border-color:#ddd}
.couponzone_list .no_coupon{padding: 100px 0;text-align:center;color:#999}
#point_coupon li{height:230px;}

View File

@ -101,6 +101,38 @@ if(!sql_query(" select cart_id from {$g5['g5_shop_order_data_table']} limit 1 ",
ADD `mb_id` varchar(20) NOT NULL DEFAULT '' AFTER `cart_id` ", true);
}
// 쿠폰존 테이블 추가
if(isset($g5['g5_shop_coupon_zone_table'])) {
if(!sql_query(" DESCRIBE {$g5['g5_shop_coupon_zone_table']} ", false)) {
sql_query(" CREATE TABLE IF NOT EXISTS `{$g5['g5_shop_coupon_zone_table']}` (
`cz_id` int(11) NOT NULL AUTO_INCREMENT,
`cz_type` tinyint(4) NOT NULL DEFAULT '0',
`cz_subject` varchar(255) NOT NULL DEFAULT '',
`cz_start` DATE NOT NULL DEFAULT '0000-00-00',
`cz_end` DATE NOT NULL DEFAULT '0000-00-00',
`cz_file` varchar(255) NOT NULL DEFAULT '',
`cz_period` int(11) NOT NULL DEFAULT '0',
`cz_point` INT(11) NOT NULL DEFAULT '0',
`cp_method` TINYINT(4) NOT NULL DEFAULT '0',
`cp_target` VARCHAR(255) NOT NULL DEFAULT '',
`cp_price` INT(11) NOT NULL DEFAULT '0',
`cp_type` TINYINT(4) NOT NULL DEFAULT '0',
`cp_trunc` INT(11) NOT NULL DEFAULT '0',
`cp_minimum` INT(11) NOT NULL DEFAULT '0',
`cp_maximum` INT(11) NOT NULL DEFAULT '0',
`cz_download` int(11) NOT NULL DEFAULT '0',
`cz_datetime` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`cz_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ", true);
}
}
// 쿠폰테이블에 cz_id 필드 추가
if(!sql_query(" select cz_id from {$g5['g5_shop_coupon_table']} limit 1 ", false)) {
sql_query(" ALTER TABLE `{$g5['g5_shop_coupon_table']}`
ADD `cz_id` int(11) NOT NULL DEFAULT '0' AFTER `mb_id` ", true);
}
echo '<p>테이블 업그레이드 완료!</p>';
include_once(G5_PATH.'/tail.sub.php');

View File

@ -0,0 +1,69 @@
<?php
include_once('./_common.php');
include_once(G5_LIB_PATH.'/json.lib.php');
if(!$member['mb_id'])
die(json_encode(array('error' => '회원 로그인 후 이용해 주십시오.')));
$cz_id = preg_replace('#[^0-9]#', '', $_GET['cz_id']);
if(!$cz_id)
die(json_encode(array('error' => '올바른 방법으로 이용해 주십시오.')));
$sql = " select * from {$g5['g5_shop_coupon_zone_table']} where cz_id = '$cz_id' ";
$cp = sql_fetch($sql);
if(!$cp['cz_id'])
die(json_encode(array('error' => '쿠폰정보가 존재하지 않습니다.')));
if(!($cp['cz_start'] <= G5_TIME_YMD && $cp['cz_end'] >= G5_TIME_YMD))
die(json_encode(array('error' => '다운로드할 수 없는 쿠폰입니다.')));
// 발급여부
if(is_coupon_downloaded($member['mb_id'], $cp['cz_id']))
die(json_encode(array('error' => '이미 다운로드하신 쿠폰입니다.')));
// 포인트 쿠폰은 회원포인트 체크
if($cp['cz_type'] && ($member['mb_point'] - $cp['cz_point']) < 0)
die(json_encode(array('error' => '보유하신 포인트가 부족하여 쿠폰을 다운로드할 수 없습니다.')));
// 쿠폰발급
$j = 0;
do {
$cp_id = get_coupon_id();
$sql3 = " select count(*) as cnt from {$g5['g5_shop_coupon_table']} where cp_id = '$cp_id' ";
$row3 = sql_fetch($sql3);
if(!$row3['cnt'])
break;
else {
if($j > 20)
die(json_encode(array('error' => 'Coupon ID Error')));
}
} while(1);
$cp = array_map('addslashes', $cp);
$cp_start = G5_TIME_YMD;
$period = $cp['cz_period'] - 1;
if($period < 0)
$period = 0;
$cp_end = date('Y-m-d', strtotime("+{$period} days", G5_SERVER_TIME));
$result = false;
$sql = " INSERT INTO {$g5['g5_shop_coupon_table']}
( cp_id, cp_subject, cp_method, cp_target, mb_id, cz_id, cp_start, cp_end, cp_type, cp_price, cp_trunc, cp_minimum, cp_maximum, cp_datetime )
VALUES
( '$cp_id', '{$cp['cz_subject']}', '{$cp['cp_method']}', '{$cp['cp_target']}', '{$member['mb_id']}', '$cz_id', '$cp_start', '$cp_end', '{$cp['cp_type']}', '{$cp['cp_price']}', '{$cp['cp_trunc']}', '{$cp['cp_minimum']}', '{$cp['cp_maximum']}', '".G5_TIME_YMDHIS."' ) ";
$result = sql_query($sql);
// 포인트 쿠폰이면 포인트 차감
if($result && $cp['cz_type'])
insert_point($member['mb_id'], (-1) * $cp['cz_point'], "쿠폰 $cp_id 발급");
// 다운로드 증가
sql_query(" update {$g5['g5_shop_coupon_zone_table']} set cz_download = cz_download + 1 where cz_id = '$cz_id' ");
die(json_encode(array('error' => '')));
?>

34
shop/couponzone.php Normal file
View File

@ -0,0 +1,34 @@
<?php
include_once('./_common.php');
$sql_common = " from {$g5['g5_shop_coupon_zone_table']}
where cz_start <= '".G5_TIME_YMD."'
and cz_end >= '".G5_TIME_YMD."' ";
$sql_order = " order by cz_id desc ";
add_javascript('<script src="'.G5_JS_URL.'/shop.couponzone.js"></script>', 100);
$g5['title'] = '쿠폰존';
include_once(G5_SHOP_PATH.'/_head.php');
if (!G5_IS_MOBILE && $is_admin)
echo '<div class="sct_admin"><a href="'.G5_ADMIN_URL.'/shop_admin/couponzonelist.php" class="btn_admin">쿠폰존 관리</a></div>';
if(G5_IS_MOBILE) {
define('G5_SHOP_CSS_URL', G5_MSHOP_SKIN_URL);
$skin_file = G5_MSHOP_SKIN_PATH.'/couponzone.10.skin.php';
} else {
define('G5_SHOP_CSS_URL', G5_SHOP_SKIN_URL);
$skin_file = G5_SHOP_SKIN_PATH.'/couponzone.10.skin.php';
}
if (is_file($skin_file)) {
include_once($skin_file);
} else {
echo '<div class="sct_nofile">'.str_replace(G5_PATH.'/', '', $skin_file).' 파일을 찾을 수 없습니다.<br>관리자에게 알려주시면 감사하겠습니다.</div>';
}
include_once(G5_SHOP_PATH.'/_tail.php');
?>

View File

@ -74,6 +74,7 @@ include_once(G5_LIB_PATH.'/latest.lib.php');
<li><a href="<?php echo G5_BBS_URL; ?>/login.php?url=<?php echo $urlencode; ?>"><b>로그인</b></a></li>
<?php } ?>
<li><a href="<?php echo G5_SHOP_URL; ?>/mypage.php">마이페이지</a></li>
<li><a href="<?php echo G5_SHOP_URL; ?>/couponzone.php">쿠폰존</a></li>
<li><a href="<?php echo G5_BBS_URL; ?>/faq.php">FAQ</a></li>
<li><a href="<?php echo G5_BBS_URL; ?>/qalist.php">1:1문의</a></li>
<li><a href="<?php echo G5_SHOP_URL; ?>/personalpay.php">개인결제</a></li>

View File

@ -0,0 +1,127 @@
<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.G5_SHOP_CSS_URL.'/style.css">', 0);
?>
<section class="couponzone_list">
<h2>다운로드 쿠폰</h2>
<p><?php echo $default['de_admin_company_name']; ?> 회원이시라면 쿠폰 다운로드 후 바로 사용하실 수 있습니다.</p>
<?php
$sql = " select * $sql_common and cz_type = '0' $sql_order ";
$result = sql_query($sql);
$coupon = '';
for($i=0; $row=sql_fetch_array($result); $i++) {
if(!$row['cz_file'])
continue;
$img_file = G5_DATA_PATH.'/coupon/'.$row['cz_file'];
if(!is_file($img_file))
continue;
$subj = get_text($row['cz_subject']);
switch($row['cp_method']) {
case '0':
$sql3 = " select it_id, it_name from {$g5['g5_shop_item_table']} where it_id = '{$row['cp_target']}' ";
$row3 = sql_fetch($sql3);
$cp_target = '<a href="./item.php?it_id='.$row3['it_id'].'">'.get_text($row3['it_name']).'</a>';
break;
case '1':
$sql3 = " select ca_id, ca_name from {$g5['g5_shop_category_table']} where ca_id = '{$row['cp_target']}' ";
$row3 = sql_fetch($sql3);
$cp_target = '<a href="./list.php?ca_id='.$row3['ca_id'].'">'.get_text($row3['ca_name']).'</a>';
break;
case '2':
$cp_target = '주문금액할인';
break;
case '3':
$cp_target = '배송비할인';
break;
}
// 다운로드 쿠폰인지
$disabled = '';
if(is_coupon_downloaded($member['mb_id'], $row['cz_id']))
$disabled = ' disabled';
$coupon .= '<li>'.PHP_EOL;
$coupon .= '<div class="coupon_img"><img src="'.str_replace(G5_PATH, G5_URL, $img_file).'" alt="'.$subj.'"></div>'.PHP_EOL;
$coupon .= '<div class="coupon_tit">'.$subj.'</div>'.PHP_EOL;
$coupon .= '<div class="coupon_date">기한 : 다운로드 후 '.number_format($row['cz_period']).'일</div>'.PHP_EOL;
$coupon .= '<div class="coupon_target">적용 : '.$cp_target.'</div>'.PHP_EOL;
$coupon .= '<div class="coupon_btn"><button type="button" class="coupon_download btn02'.$disabled.'" data-cid="'.$row['cz_id'].'">쿠폰다운로드</button></div>'.PHP_EOL;
$coupon .= '</li>'.PHP_EOL;
}
if($coupon)
echo '<ul>'.PHP_EOL.$coupon.'</ul>'.PHP_EOL;
else
echo '<p class="no_coupon">사용할 수 있는 쿠폰이 없습니다.</p>';
?>
</section>
<section class="couponzone_list" id="point_coupon">
<h2>포인트 쿠폰</h2>
<p>보유하신 <?php echo $default['de_admin_company_name']; ?> 회원 포인트를 쿠폰으로 교환하실 수 있습니다.</p>
<?php
$sql = " select * $sql_common and cz_type = '1' $sql_order ";
$result = sql_query($sql);
$coupon = '';
for($i=0; $row=sql_fetch_array($result); $i++) {
if(!$row['cz_file'])
continue;
$img_file = G5_DATA_PATH.'/coupon/'.$row['cz_file'];
if(!is_file($img_file))
continue;
$subj = get_text($row['cz_subject']);
switch($row['cp_method']) {
case '0':
$sql3 = " select it_id, it_name from {$g5['g5_shop_item_table']} where it_id = '{$row['cp_target']}' ";
$row3 = sql_fetch($sql3);
$cp_target = '<a href="./item.php?it_id='.$row3['it_id'].'">'.get_text($row3['it_name']).'</a>';
break;
case '1':
$sql3 = " select ca_id, ca_name from {$g5['g5_shop_category_table']} where ca_id = '{$row['cp_target']}' ";
$row3 = sql_fetch($sql3);
$cp_target = '<a href="./list.php?ca_id='.$row3['ca_id'].'">'.get_text($row3['ca_name']).'</a>';
break;
case '2':
$cp_target = '주문금액할인';
break;
case '3':
$cp_target = '배송비할인';
break;
}
// 다운로드 쿠폰인지
$disabled = '';
if(is_coupon_downloaded($member['mb_id'], $row['cz_id']))
$disabled = ' disabled';
$coupon .= '<li>'.PHP_EOL;
$coupon .= '<div class="coupon_img"><img src="'.str_replace(G5_PATH, G5_URL, $img_file).'" alt="'.$subj.'"></div>'.PHP_EOL;
$coupon .= '<div class="coupon_tit">'.$subj.'</div>'.PHP_EOL;
$coupon .= '<div class="coupon_date">기한 : 다운로드 후 '.number_format($row['cz_period']).'일</div>'.PHP_EOL;
$coupon .= '<div class="coupon_target">적용 : '.$cp_target.'</div>'.PHP_EOL;
$coupon .= '<div class="coupon_point">포인트 '.number_format($row['cz_point']).'점 차감</div>'.PHP_EOL;
$coupon .= '<div class="coupon_btn"><button type="button" class="coupon_download btn02'.$disabled.'" data-cid="'.$row['cz_id'].'">쿠폰다운로드</button></div>'.PHP_EOL;
$coupon .= '</li>'.PHP_EOL;
}
if($coupon)
echo '<ul>'.PHP_EOL.$coupon.'</ul>'.PHP_EOL;
else
echo '<p class="no_coupon">사용할 수 있는 쿠폰이 없습니다.</p>';
?>
</section>

View File

@ -545,4 +545,23 @@
.sqa_section p {padding:0;width:100%}
.sqa_con_full {padding:0;height:auto !important}
.sqa_con_btn {margin:5px 0 0;text-align:right}
.sqa_con_btn button {margin:0;padding:5px;border:0;background:#565e60;color:#fff}
.sqa_con_btn button {margin:0;padding:5px;border:0;background:#565e60;color:#fff}
/*쿠폰존 리스트*/
.couponzone_list{margin:0 0 50px;}
.couponzone_list h2{margin:0 0 5px}
.couponzone_list p{margin:0 0 5px;}
.couponzone_list ul{padding:0;margin:0;list-style:none}
.couponzone_list ul:after {display:block;visibility:hidden;clear:both;content:""}
.couponzone_list ul li{float:left;width:230px;height:210px;border:1px solid #e9e9e9;background:#f2f6f9;padding:0;margin:0 10px 10px 0;line-height:1.2em}
.couponzone_list ul li img{width:100%;height:auto}
.couponzone_list ul li .coupon_img{height:100px;overflow:hidden;border-bottom:1px solid #e9e9e9}
.couponzone_list ul li .coupon_tit{margin:10px 10px 5px;font-weight:bold;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;}
.couponzone_list ul li .coupon_date{margin: 5px 10px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;}
.couponzone_list ul li .coupon_target{margin: 5px 10px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;}
.couponzone_list ul li .coupon_point{margin: 5px 10px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;}
.couponzone_list ul li .coupon_btn{margin:10px;text-align:center;}
.couponzone_list ul li .coupon_btn .btn02{width:60%;padding:7px 0;background:#ec2037;border-color:#c92033}
.couponzone_list ul li .coupon_btn .disabled {background: #ddd;border:1px;color:#999;border-color:#ddd}
.couponzone_list .no_coupon{padding: 100px 0;text-align:center;color:#999}
#point_coupon li{height:230px;}

View File

@ -34,7 +34,7 @@ ul,li{list-style:none;padding:0;margin:0;}
#hd_tnb{margin-top:-1px}
#hd_tnb:after {display:block;visibility:hidden;clear:both;content:""}
#hd_tnb li{float:left;width:25%;}
#hd_tnb li{float:left;width:20%;}
#hd_tnb li a{display:block;color:#a8a8a8;background:#f9f9f9;border:1px solid #e9e9e9;border-right:none;height:30px;line-height:30px;font-size:0.92em}
#hd_tnb li a:hover{background:#f1f1f1}
#hd_tnb li:first-child a{border-left:none}

View File

@ -28,9 +28,9 @@ include_once(G5_LIB_PATH.'/latest.lib.php');
<?php } else { ?>
<li><a href="<?php echo G5_BBS_URL; ?>/login.php?url=<?php echo $urlencode; ?>">LOGIN</a></li>
<li><a href="<?php echo G5_BBS_URL ?>/register.php" id="snb_join">JOIN</a></li>
<?php } ?>
<li><a href="<?php echo G5_SHOP_URL; ?>/mypage.php">MY PAGE</a></li>
<li><a href="<?php echo G5_SHOP_URL; ?>/couponzone.php">쿠폰존</a></li>
<li><a href="<?php echo G5_SHOP_URL; ?>/cart.php" class="tnb_cart"><span></span>CART</a></li>

View File

@ -0,0 +1,127 @@
<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.G5_SHOP_CSS_URL.'/style.css">', 0);
?>
<section class="couponzone_list">
<h2>다운로드 쿠폰</h2>
<p><?php echo $default['de_admin_company_name']; ?> 회원이시라면 쿠폰 다운로드 후 바로 사용하실 수 있습니다.</p>
<?php
$sql = " select * $sql_common and cz_type = '0' $sql_order ";
$result = sql_query($sql);
$coupon = '';
for($i=0; $row=sql_fetch_array($result); $i++) {
if(!$row['cz_file'])
continue;
$img_file = G5_DATA_PATH.'/coupon/'.$row['cz_file'];
if(!is_file($img_file))
continue;
$subj = get_text($row['cz_subject']);
switch($row['cp_method']) {
case '0':
$sql3 = " select it_id, it_name from {$g5['g5_shop_item_table']} where it_id = '{$row['cp_target']}' ";
$row3 = sql_fetch($sql3);
$cp_target = '<a href="./item.php?it_id='.$row3['it_id'].'">'.get_text($row3['it_name']).'</a>';
break;
case '1':
$sql3 = " select ca_id, ca_name from {$g5['g5_shop_category_table']} where ca_id = '{$row['cp_target']}' ";
$row3 = sql_fetch($sql3);
$cp_target = '<a href="./list.php?ca_id='.$row3['ca_id'].'">'.get_text($row3['ca_name']).'</a>';
break;
case '2':
$cp_target = '주문금액할인';
break;
case '3':
$cp_target = '배송비할인';
break;
}
// 다운로드 쿠폰인지
$disabled = '';
if(is_coupon_downloaded($member['mb_id'], $row['cz_id']))
$disabled = ' disabled';
$coupon .= '<li><div class="coupon_wr">'.PHP_EOL;
$coupon .= '<div class="coupon_img"><img src="'.str_replace(G5_PATH, G5_URL, $img_file).'" alt="'.$subj.'"></div>'.PHP_EOL;
$coupon .= '<div class="coupon_tit">'.$subj.'</div>'.PHP_EOL;
$coupon .= '<div class="coupon_date">기한 : 다운로드 후 '.number_format($row['cz_period']).'일</div>'.PHP_EOL;
$coupon .= '<div class="coupon_target">적용 : '.$cp_target.'</div>'.PHP_EOL;
$coupon .= '<div class="coupon_btn"><button type="button" class="coupon_download btn02'.$disabled.'" data-cid="'.$row['cz_id'].'">쿠폰다운로드</button></div>'.PHP_EOL;
$coupon .= '</div></li>'.PHP_EOL;
}
if($coupon)
echo '<ul>'.PHP_EOL.$coupon.'</ul>'.PHP_EOL;
else
echo '<p class="no_coupon">사용할 수 있는 쿠폰이 없습니다.</p>';
?>
</section>
<section class="couponzone_list" id="coupon_point">
<h2>포인트 쿠폰</h2>
<p>보유하신 <?php echo $default['de_admin_company_name']; ?> 회원 포인트를 쿠폰으로 교환하실 수 있습니다.</p>
<?php
$sql = " select * $sql_common and cz_type = '1' $sql_order ";
$result = sql_query($sql);
$coupon = '';
for($i=0; $row=sql_fetch_array($result); $i++) {
if(!$row['cz_file'])
continue;
$img_file = G5_DATA_PATH.'/coupon/'.$row['cz_file'];
if(!is_file($img_file))
continue;
$subj = get_text($row['cz_subject']);
switch($row['cp_method']) {
case '0':
$sql3 = " select it_id, it_name from {$g5['g5_shop_item_table']} where it_id = '{$row['cp_target']}' ";
$row3 = sql_fetch($sql3);
$cp_target = '<a href="./item.php?it_id='.$row3['it_id'].'">'.get_text($row3['it_name']).'</a>';
break;
case '1':
$sql3 = " select ca_id, ca_name from {$g5['g5_shop_category_table']} where ca_id = '{$row['cp_target']}' ";
$row3 = sql_fetch($sql3);
$cp_target = '<a href="./list.php?ca_id='.$row3['ca_id'].'">'.get_text($row3['ca_name']).'</a>';
break;
case '2':
$cp_target = '주문금액할인';
break;
case '3':
$cp_target = '배송비할인';
break;
}
// 다운로드 쿠폰인지
$disabled = '';
if(is_coupon_downloaded($member['mb_id'], $row['cz_id']))
$disabled = ' disabled';
$coupon .= '<li><div class="coupon_wr">'.PHP_EOL;
$coupon .= '<div class="coupon_img"><img src="'.str_replace(G5_PATH, G5_URL, $img_file).'" alt="'.$subj.'"></div>'.PHP_EOL;
$coupon .= '<div class="coupon_tit">'.$subj.'</div>'.PHP_EOL;
$coupon .= '<div class="coupon_date">기한 : 다운로드 후 '.number_format($row['cz_period']).'일</div>'.PHP_EOL;
$coupon .= '<div class="coupon_target">적용 : '.$cp_target.'</div>'.PHP_EOL;
$coupon .= '<div class="coupon_point">포인트 '.number_format($row['cz_point']).'점 차감</div>'.PHP_EOL;
$coupon .= '<div class="coupon_btn"><button type="button" class="coupon_download btn02'.$disabled.'" data-cid="'.$row['cz_id'].'">쿠폰다운로드</button></div>'.PHP_EOL;
$coupon .= '</div></li>'.PHP_EOL;
}
if($coupon)
echo '<ul>'.PHP_EOL.$coupon.'</ul>'.PHP_EOL;
else
echo '<p class="no_coupon">사용할 수 있는 쿠폰이 없습니다.</p>';
?>
</section>

View File

@ -315,4 +315,24 @@ a.qa_wr{padding:10px 0;display:block;width:100%;text-align:center;background:#34
#fancyalert_inner button {margin:15px 0 0;padding:10px 30px;border:0;background:#000;color:#fff}
#fancyalert_bg {z-index:0;position:absolute;top:0;left:0;width:100%;height:100%;vertical-align:middle;background:#000;text-align:center;opacity: 0.7}
#sit_sms_new .tbl_frm01 th {width:100px}
#sit_sms_new .tbl_frm01 th {width:100px}
/*쿠폰존 리스트*/
.couponzone_list{margin:0 0 50px;}
.couponzone_list h2{margin:10px 10px 5px}
.couponzone_list p{margin:0 10px 5px;}
.couponzone_list ul{padding:0 5px;margin:0;list-style:none}
.couponzone_list ul:after {display:block;visibility:hidden;clear:both;content:""}
.couponzone_list ul li{float:left;width:48%;height:210px;padding:0 1% 15px;}
.couponzone_list ul li .coupon_wr{border:1px solid #e9e9e9;background:#f2f6f9;line-height:1.2em;}
.couponzone_list ul li img{width:100%;height:100%}
.couponzone_list ul li .coupon_img{height:100px;overflow:hidden;border-bottom:1px solid #e9e9e9}
.couponzone_list ul li .coupon_tit{margin:10px 10px 5px;font-weight:bold;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;}
.couponzone_list ul li .coupon_date{margin: 5px 10px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;}
.couponzone_list ul li .coupon_target{margin: 5px 10px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;}
.couponzone_list ul li .coupon_point{margin: 5px 10px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;}
.couponzone_list ul li .coupon_btn{margin:10px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;text-align:center}
.couponzone_list ul li .coupon_btn .btn02{width:70%;padding:7px 0;background:#ec2037;border-color:#c92033}
.couponzone_list ul li .coupon_btn .disabled {background: #ddd;border:1px;color:#999;border-color:#ddd}
.couponzone_list .no_coupon{padding: 100px 0;text-align:center;color:#999}
#point_coupon li{height:230px;}

View File

@ -74,6 +74,7 @@ include_once(G5_LIB_PATH.'/latest.lib.php');
<li><a href="<?php echo G5_BBS_URL; ?>/login.php?url=<?php echo $urlencode; ?>"><b>로그인</b></a></li>
<?php } ?>
<li><a href="<?php echo G5_SHOP_URL; ?>/mypage.php">마이페이지</a></li>
<li><a href="<?php echo G5_SHOP_URL; ?>/couponzone.php">쿠폰존</a></li>
<li><a href="<?php echo G5_BBS_URL; ?>/faq.php">FAQ</a></li>
<li><a href="<?php echo G5_BBS_URL; ?>/qalist.php">1:1문의</a></li>
<li><a href="<?php echo G5_SHOP_URL; ?>/personalpay.php">개인결제</a></li>

View File

@ -0,0 +1,127 @@
<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.G5_SHOP_CSS_URL.'/style.css">', 0);
?>
<section class="couponzone_list">
<h2>다운로드 쿠폰</h2>
<p><?php echo $default['de_admin_company_name']; ?> 회원이시라면 쿠폰 다운로드 후 바로 사용하실 수 있습니다.</p>
<?php
$sql = " select * $sql_common and cz_type = '0' $sql_order ";
$result = sql_query($sql);
$coupon = '';
for($i=0; $row=sql_fetch_array($result); $i++) {
if(!$row['cz_file'])
continue;
$img_file = G5_DATA_PATH.'/coupon/'.$row['cz_file'];
if(!is_file($img_file))
continue;
$subj = get_text($row['cz_subject']);
switch($row['cp_method']) {
case '0':
$sql3 = " select it_id, it_name from {$g5['g5_shop_item_table']} where it_id = '{$row['cp_target']}' ";
$row3 = sql_fetch($sql3);
$cp_target = '<a href="./item.php?it_id='.$row3['it_id'].'">'.get_text($row3['it_name']).'</a>';
break;
case '1':
$sql3 = " select ca_id, ca_name from {$g5['g5_shop_category_table']} where ca_id = '{$row['cp_target']}' ";
$row3 = sql_fetch($sql3);
$cp_target = '<a href="./list.php?ca_id='.$row3['ca_id'].'">'.get_text($row3['ca_name']).'</a>';
break;
case '2':
$cp_target = '주문금액할인';
break;
case '3':
$cp_target = '배송비할인';
break;
}
// 다운로드 쿠폰인지
$disabled = '';
if(is_coupon_downloaded($member['mb_id'], $row['cz_id']))
$disabled = ' disabled';
$coupon .= '<li>'.PHP_EOL;
$coupon .= '<div class="coupon_img"><img src="'.str_replace(G5_PATH, G5_URL, $img_file).'" alt="'.$subj.'"></div>'.PHP_EOL;
$coupon .= '<div class="coupon_tit">'.$subj.'</div>'.PHP_EOL;
$coupon .= '<div class="coupon_date">기한 : 다운로드 후 '.number_format($row['cz_period']).'일</div>'.PHP_EOL;
$coupon .= '<div class="coupon_target">적용 : '.$cp_target.'</div>'.PHP_EOL;
$coupon .= '<div class="coupon_btn"><button type="button" class="coupon_download btn02'.$disabled.'" data-cid="'.$row['cz_id'].'">쿠폰다운로드</button></div>'.PHP_EOL;
$coupon .= '</li>'.PHP_EOL;
}
if($coupon)
echo '<ul>'.PHP_EOL.$coupon.'</ul>'.PHP_EOL;
else
echo '<p class="no_coupon">사용할 수 있는 쿠폰이 없습니다.</p>';
?>
</section>
<section class="couponzone_list" id="point_coupon">
<h2>포인트 쿠폰</h2>
<p>보유하신 <?php echo $default['de_admin_company_name']; ?> 회원 포인트를 쿠폰으로 교환하실 수 있습니다.</p>
<?php
$sql = " select * $sql_common and cz_type = '1' $sql_order ";
$result = sql_query($sql);
$coupon = '';
for($i=0; $row=sql_fetch_array($result); $i++) {
if(!$row['cz_file'])
continue;
$img_file = G5_DATA_PATH.'/coupon/'.$row['cz_file'];
if(!is_file($img_file))
continue;
$subj = get_text($row['cz_subject']);
switch($row['cp_method']) {
case '0':
$sql3 = " select it_id, it_name from {$g5['g5_shop_item_table']} where it_id = '{$row['cp_target']}' ";
$row3 = sql_fetch($sql3);
$cp_target = '<a href="./item.php?it_id='.$row3['it_id'].'">'.get_text($row3['it_name']).'</a>';
break;
case '1':
$sql3 = " select ca_id, ca_name from {$g5['g5_shop_category_table']} where ca_id = '{$row['cp_target']}' ";
$row3 = sql_fetch($sql3);
$cp_target = '<a href="./list.php?ca_id='.$row3['ca_id'].'">'.get_text($row3['ca_name']).'</a>';
break;
case '2':
$cp_target = '주문금액할인';
break;
case '3':
$cp_target = '배송비할인';
break;
}
// 다운로드 쿠폰인지
$disabled = '';
if(is_coupon_downloaded($member['mb_id'], $row['cz_id']))
$disabled = ' disabled';
$coupon .= '<li>'.PHP_EOL;
$coupon .= '<div class="coupon_img"><img src="'.str_replace(G5_PATH, G5_URL, $img_file).'" alt="'.$subj.'"></div>'.PHP_EOL;
$coupon .= '<div class="coupon_tit">'.$subj.'</div>'.PHP_EOL;
$coupon .= '<div class="coupon_date">기한 : 다운로드 후 '.number_format($row['cz_period']).'일</div>'.PHP_EOL;
$coupon .= '<div class="coupon_target">적용 : '.$cp_target.'</div>'.PHP_EOL;
$coupon .= '<div class="coupon_point">포인트 '.number_format($row['cz_point']).'점 차감</div>'.PHP_EOL;
$coupon .= '<div class="coupon_btn"><button type="button" class="coupon_download btn02'.$disabled.'" data-cid="'.$row['cz_id'].'">쿠폰다운로드</button></div>'.PHP_EOL;
$coupon .= '</li>'.PHP_EOL;
}
if($coupon)
echo '<ul>'.PHP_EOL.$coupon.'</ul>'.PHP_EOL;
else
echo '<p class="no_coupon">사용할 수 있는 쿠폰이 없습니다.</p>';
?>
</section>

View File

@ -545,4 +545,24 @@
.sqa_section p {padding:0;width:100%}
.sqa_con_full {padding:0;height:auto !important}
.sqa_con_btn {margin:5px 0 0;text-align:right}
.sqa_con_btn button {margin:0;padding:5px;border:0;background:#565e60;color:#fff}
.sqa_con_btn button {margin:0;padding:5px;border:0;background:#565e60;color:#fff}
/*쿠폰존 리스트*/
.couponzone_list{margin:0 0 50px;}
.couponzone_list h2{margin:0 0 5px}
.couponzone_list p{margin:0 0 5px;}
.couponzone_list ul{padding:0;margin:0;list-style:none}
.couponzone_list ul:after {display:block;visibility:hidden;clear:both;content:""}
.couponzone_list ul li{float:left;width:230px;height:210px;border:1px solid #e9e9e9;background:#f2f6f9;padding:0;margin:0 10px 10px 0;line-height:1.2em}
.couponzone_list ul li img{width:100%;height:auto}
.couponzone_list ul li .coupon_img{height:100px;overflow:hidden;border-bottom:1px solid #e9e9e9}
.couponzone_list ul li .coupon_tit{margin:10px 10px 5px;font-weight:bold;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;}
.couponzone_list ul li .coupon_date{margin: 5px 10px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;}
.couponzone_list ul li .coupon_target{margin: 5px 10px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;}
.couponzone_list ul li .coupon_point{margin: 5px 10px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;}
.couponzone_list ul li .coupon_btn{margin:10px;text-align:center}
.couponzone_list ul li .coupon_btn .btn02{width:60%;padding:7px 0;background:#ec2037;border-color:#c92033}
.couponzone_list ul li .coupon_btn .disabled {background: #ddd;border:1px;color:#999;border-color:#ddd}
.couponzone_list .no_coupon{padding: 100px 0;text-align:center;color:#999}
#point_coupon li{height:230px;}