#211 지역별 추가배송비 추가

This commit is contained in:
chicpro
2013-06-14 16:34:49 +09:00
parent 37dc095c2c
commit 8352d4ac8e
7 changed files with 362 additions and 1 deletions

View File

@ -17,6 +17,7 @@ $menu['menu400'] = array (
array('400490', '마일리지관리', G4_ADMIN_URL.'/shop_admin/mileagelist.php', 'scf_mileage'),
array('400650', '쿠폰관리', G4_ADMIN_URL.'/shop_admin/couponlist.php', 'scf_coupon'),
array('400500', '배송일괄처리', G4_ADMIN_URL.'/shop_admin/deliverylist.php', 'scf_deli', 1),
array('400740', '배송업체관리', G4_ADMIN_URL.'/shop_admin/deliverycodelist.php', 'scf_deli_co', 1)
array('400740', '배송업체관리', G4_ADMIN_URL.'/shop_admin/deliverycodelist.php', 'scf_deli_co', 1),
array('400750', '추가배송비관리', G4_ADMIN_URL.'/shop_admin/sendcostlist.php', 'scf_sendcost', 1)
);
?>

View File

@ -0,0 +1,161 @@
<?php
$sub_menu = '400750';
include_once('./_common.php');
auth_check($auth[$sub_menu], "r");
$token = get_token();
$sql_common = " from {$g4['shop_sendcost_table']} ";
$sql_search = " where (1) ";
$sql_order = " order by sc_id desc ";
$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 == '') $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
$sql = " select *
{$sql_common}
{$sql_search}
{$sql_order}
limit {$from_record}, {$rows} ";
$result = sql_query($sql);
$g4['title'] = '추가배송비관리';
include_once (G4_ADMIN_PATH.'/admin.head.php');
?>
<section id="scp_list" class="cbox">
<h2>추가배송비 내역</h2>
<form name="fsendcost" id="fsendcost" method="post" action="./sendcostupdate.php" onsubmit="return fsendcost_submit(this);">
<input type="hidden" name="w" value="d">
<input type="hidden" name="page" value="<?php echo $page; ?>">
<input type="hidden" name="token" value="<?php echo $token; ?>">
<table class="tbl_pt_list">
<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>
</tr>
</thead>
<tbody>
<?php
for($i=0; $row=sql_fetch_array($result); $i++) {
?>
<tr>
<td class="td_chk">
<input type="hidden" id="sc_id_<?php echo $i; ?>" name="sc_id[<?php echo $i; ?>]" value="<?php echo $row['sc_id']; ?>">
<input type="checkbox" id="chk_<?php echo $i; ?>" name="chk[]" value="1" title="내역선택">
</td>
<td><?php echo $row['sc_name']; ?></td>
<td><?php echo preg_replace('/([0-9]{3})([0-9]{3})/', '\\1-\\2', $row['sc_zip1']).' ~ '.preg_replace('/([0-9]{3})([0-9]{3})/', '\\1-\\2', $row['sc_zip2']); ?></td>
<td><?php echo number_format($row['sc_amount']); ?></td>
</tr>
<?php
}
if ($i == 0)
echo '<tr><td colspan="4" class="empty_table">자료가 없습니다.</td></tr>';
?>
</tbody>
</table>
<div class="btn_list">
<input type="submit" name="act_button" value="선택삭제" onclick="document.pressed=this.value">
</div>
</form>
</section>
<?php echo get_paging(G4_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['PHP_SELF']}?$qstr&amp;page="); ?>
<section id="point_mng" class="cbox">
<h2>추가배송비 등록</h2>
<form name="fsendcost2" method="post" id="fsendcost2" action="./sendcostupdate.php" autocomplete="off">
<input type="hidden" name="token" value="<?php echo $token; ?>">
<table class="frm_tbl">
<colgroup>
<col class="grid_3">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row"><label for="sc_name">지역명<strong class="sound_only">필수</strong></label></th>
<td><input type="text" name="sc_name" value="" id="sc_name" class="required frm_input" size="30" required></td>
</tr>
<tr>
<th scope="row"><label for="sc_zip1">우편번호 시작<strong class="sound_only">필수</strong></label></th>
<td>
<input type="text" name="sc_zip1" id="sc_zip1" required class="required frm_input" size="10">
<button type="button" class="sch_zipcode">우편번호검색</button>
</td>
</tr>
<tr>
<th scope="row"><label for="sc_zip2">우편번호 끝<strong class="sound_only">필수</strong></label></th>
<td>
<input type="text" name="sc_zip2" id="sc_zip2" required class="required frm_input" size="10">
<button type="button" class="sch_zipcode">우편번호검색</button>
</td>
</tr>
<tr>
<th scope="row"><label for="sc_amount">추가배송비<strong class="sound_only">필수</strong></label></th>
<td><input type="text" name="sc_amount" id="sc_amount" size="8" required class="required frm_input"> 원</td>
</tr>
</tbody>
</table>
<div class="btn_confirm">
<input type="submit" value="확인" class="btn_submit">
</div>
</form>
</section>
<script>
$(function() {
$(".sch_zipcode").click(function() {
var idx = $(".sch_zipcode").index($(this));
var url = "./sendcostzipcode.php?no="+(idx+1);
var opt = "left=50,top=50,width=500,height=400";
window.open(url, "win_zipcode", opt);
});
});
function fsendcost_submit(f)
{
if (!is_checked("chk[]")) {
alert(document.pressed+" 하실 항목을 하나 이상 선택하세요.");
return false;
}
if(document.pressed == "선택삭제") {
if(!confirm("선택한 자료를 정말 삭제하시겠습니까?")) {
return false;
}
}
return true;
}
</script>
<?php
include_once(G4_ADMIN_PATH.'/admin.tail.php');
?>

View File

@ -0,0 +1,45 @@
<?php
$sub_menu = '400750';
include_once('./_common.php');
check_demo();
auth_check($auth[$sub_menu], "w");
$w = $_POST['w'];
if($w == 'd') {
if(!count($_POST['chk']))
alert('삭제하실 항목을 하나이상 선택해 주십시오.');
$count = count($_POST['sc_id']);
for($i=0; $i<$count; $i++) {
if($_POST['chk'][$i]) {
$sc_id = $_POST['sc_id'][$i];
sql_query(" delete from {$g4['shop_sendcost_table']} where sc_id = '$sc_id' ");
}
}
} else {
$sc_name = trim($_POST['sc_name']);
$sc_zip1 = preg_replace('/[^0-9]/', '', $_POST['sc_zip1']);
$sc_zip2 = preg_replace('/[^0-9]/', '', $_POST['sc_zip2']);
$sc_amount = preg_replace('/[^0-9]/', '', $_POST['sc_amount']);
if(!$sc_name)
alert('지역명을 입력해 주십시오.');
if(!$sc_zip1)
alert('우편번호 시작을 입력해 주십시오.');
if(!$sc_zip2)
alert('우편번호 끝을 입력해 주십시오.');
if(!$sc_amount)
alert('추가배송비를 입력해 주십시오.');
$sql = " insert into {$g4['shop_sendcost_table']}
( sc_name, sc_zip1, sc_zip2, sc_amount )
values
( '$sc_name', '$sc_zip1', '$sc_zip2', '$sc_amount' ) ";
sql_query($sql);
}
goto_url('./sendcostlist.php?page='.$page);
?>

View File

@ -0,0 +1,117 @@
<?php
$sub_menu = '400750';
include_once('./_common.php');
auth_check($auth[$sub_menu], "r");
$addr = trim($_GET['addr']);
$no = trim($_GET['no']);
if($addr) {
$option_list = '';
$zipfile = array();
$fp = fopen(G4_BBS_PATH."/zip.db", "r");
while(!feof($fp)) {
$zipfile[] = fgets($fp, 4096);
}
fclose($fp);
$search_count = 0;
while ($zipcode = each($zipfile))
{
if(strstr(substr($zipcode[1],8,512), $addr))
{
$address = trim($zipcode[1]);
$list[$search_count] = $address;
$search_count++;
}
}
if($search_count) {
natsort($list);
if($no == 2)
$list = array_reverse($list);
$result = array();
foreach($list as $value) {
$code = substr($value, 0, 7);
$result[] = '<input type="hidden" name="code[]" value="'.$code.'">'.$value.' <button type="button" class="select_btn">선택</button>'.PHP_EOL;
}
}
}
$g4['title'] = "우편번호 찾기";
include_once(G4_PATH.'/head.sub.php');
?>
<div>
<form name="fzipcode" id="fzipcode" method="get">
<input type="hidden" name="no" value="<?php echo $no; ?>">
<table>
<tr>
<td>우편번호 찾기</td>
</tr>
<tr>
<td>주소지의 시/군을 입력하세요.</td>
</tr>
<tr>
<td>
<label for="addr">주소</label>
<input type="text" id="addr" name="addr" value="<? echo stripslashes($addr); ?>" size="20" />
<input type="submit" value=" 검색 " />
</td>
</tr>
</table>
</form>
<?php
if($search_count) {
?>
<p>검색결과<p>
<ul>
<?php
for($i=0; $i<$search_count; $i++) {
?>
<li><?php echo $result[$i]; ?></li>
<?php
}
?>
</ul>
<?php
} else {
?>
<p>검색된 결과가 없습니다.</p>
<?php
}
?>
</div>
<script>
$(function() {
$("#fzipcode").submit(function() {
if($.trim($("input[name=addr]").val()) == "") {
alert("주소를 입력해 주십시오.");
return false;
}
return true;
});
$(".select_btn").click(function() {
var code = $(this).closest("li").find("input[name='code[]']").val();
var $opener = window.opener;
$opener.$("input[name=sc_zip<?php echo $no; ?>]").val(code);
window.close();
});
});
</script>
<?php
include_once(G4_PATH."/tail.sub.php");
?>

View File

@ -312,4 +312,20 @@ if(!$result) {
ADD `od_receipt_amount` INT(11) NOT NULL DEFAULT '0' AFTER `od_temp_point`,
ADD `od_receipt_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `od_bank_account` ", false);
}
// 추가배송비 테이블
$sql = " select sc_id from {$g4['shop_sendcost_table']} limit 1 ";
$result = sql_query($sql, false);
if(!$result) {
sql_query(" CREATE TABLE IF NOT EXISTS `{$g4['shop_sendcost_table']}` (
`sc_id` INT(11) NOT NULL AUTO_INCREMENT,
`sc_name` VARCHAR(255) NOT NULL DEFAULT '',
`sc_zip1` VARCHAR(10) NOT NULL DEFAULT '',
`sc_zip2` VARCHAR(10) NOT NULL DEFAULT '',
`sc_amount` INT(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`sc_id`),
KEY `sc_zip1` (`sc_zip1`),
KEY `sc_zip2` (`sc_zip2`)
)", true);
}
?>

View File

@ -494,6 +494,7 @@ if($shop_install) {
fwrite($f, "\$g4['shop_wish_table'] = SHOP_TABLE_PREFIX.'wish'; // 보관함(위시리스트) 테이블\n");
fwrite($f, "\$g4['shop_mileage_table'] = SHOP_TABLE_PREFIX.'mileage'; // 마일리지 테이블\n");
fwrite($f, "\$g4['shop_coupon_table'] = SHOP_TABLE_PREFIX.'coupon'; // 쿠폰정보 테이블\n");
fwrite($f, "\$g4['shop_sendcost_table'] = SHOP_TABLE_PREFIX.'sendcost'; // 추가배송비 테이블\n");
fwrite($f, "?>");
}

View File

@ -652,6 +652,26 @@ CREATE TABLE IF NOT EXISTS `shop_mileage` (
KEY `mb_id` (`mb_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `shop_sendcost`
--
DROP TABLE IF EXISTS `shop_sendcost`;
CREATE TABLE IF NOT EXISTS `shop_sendcost` (
`sc_id` INT(11) NOT NULL AUTO_INCREMENT,
`sc_name` VARCHAR(255) NOT NULL DEFAULT '',
`sc_zip1` VARCHAR(10) NOT NULL DEFAULT '',
`sc_zip2` VARCHAR(10) NOT NULL DEFAULT '',
`sc_amount` INT(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`sc_id`),
KEY `sc_zip1` (`sc_zip1`),
KEY `sc_zip2` (`sc_zip2`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `shop_wish`
--