재입고SMS 알림 기능 추가

This commit is contained in:
chicpro
2014-02-26 11:06:10 +09:00
parent 4a9c29d3be
commit e2ea67feba
13 changed files with 452 additions and 4 deletions

73
shop/itemstocksms.php Normal file
View File

@ -0,0 +1,73 @@
<?php
include_once('./_common.php');
$g5['title'] = '상품 재입고SMS 알림요청 등록';
include_once(G5_PATH.'/head.sub.php');
// 상품정보
$sql = " select it_id, it_name, it_soldout, it_stock_sms
from {$g5['g5_shop_item_table']}
where it_id = '$it_id' ";
$it = sql_fetch($sql);
if(!$it['it_id'])
alert_close('상품정보가 존재하지 않습니다.');
if(!$it['it_soldout'] || !$it['it_stock_sms'])
alert_close('재입고SMS 알림을 신청할 수 없는 상품입니다.');
?>
<div>
<h2><?php echo $g5['title']; ?></h2>
<form name="fstocksms" method="post" action="<?php echo G5_HTTPS_SHOP_URL; ?>/itemstocksmsupdate.php" onsubmit="return fstocksms_submit(this);" autocomplete="off">
<input type="hidden" name="it_id" value="<?php echo $it_id; ?>">
<table>
<colgroup>
<col class="grid_4">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row">상품</th>
<td><?php echo $it['it_name']; ?></td>
</tr>
<tr>
<th scope="row"><label for="ss_hp">휴대폰번호</label></th>
<td><input type="text" name="ss_hp" value="<?php echo $member['mb_hp']; ?>" id="ss_hp" required class="required frm_input"></td>
</tr>
</tbody>
</table>
<div>
개인정보처리방침안내
<textarea readonly><?php echo get_text($config['cf_privacy']) ?></textarea>
<label for="agree">개인정보처리방침안내의 내용에 동의합니다.</label>
<input type="checkbox" name="agree" value="1" id="agree">
</div>
<div>
<input type="submit" value="확인">
<button type="button" onclick="window.close();">닫기</button>
</div>
</form>
</div>
<script>
function fstocksms_submit(f)
{
if(!f.agree.checked) {
alert("개인정보처리방침안내에 동의해 주십시오.");
return false;
}
if(confirm("재입고SMS 알림 요청을 등록하시겠습니까?")) {
return true;
} else {
window.close();
return false;
}
}
</script>
<?php
include_once(G5_PATH.'/tail.sub.php');
?>

View File

@ -0,0 +1,43 @@
<?php
include_once('./_common.php');
// 상품정보
$sql = " select it_id, it_name, it_soldout, it_stock_sms
from {$g5['g5_shop_item_table']}
where it_id = '$it_id' ";
$it = sql_fetch($sql);
if(!$it['it_id'])
alert_close('상품정보가 존재하지 않습니다.');
if(!$it['it_soldout'] || !$it['it_stock_sms'])
alert_close('재입고SMS 알림을 신청할 수 없는 상품입니다.');
$ss_hp = hyphen_hp_number($ss_hp);
if(!$ss_hp)
alert('휴대폰번호를 입력해 주십시오.');
if(!$agree)
alert('개인정보처리방침안내에 동의해 주십시오.');
// 중복등록 체크
$sql = " select count(*) as cnt
from {$g5['g5_shop_item_stocksms_table']}
where it_id = '$it_id'
and ss_hp = '$ss_hp'
and ss_send = '0' ";
$row = sql_fetch($sql);
if($row['cnt'])
alert_close('해당 상품에 대하여 이전에 알림 요청을 등록한 내역이 있습니다.');
// 정보입력
$sql = " insert into {$g5['g5_shop_item_stocksms_table']}
set it_id = '$it_id',
ss_hp = '$ss_hp',
ss_ip = '{$_SERVER['REMOTE_ADDR']}',
ss_datetime = '".G5_TIME_YMDHIS."' ";
sql_query($sql);
alert_close('재입고SMS 알림 요청 등록이 완료됐습니다.');
?>