모바일 배송지목록 기능 추가

This commit is contained in:
chicpro
2013-09-30 13:28:22 +09:00
parent 446570b3d4
commit f8e1e9eb9c
5 changed files with 100 additions and 65 deletions

View File

@ -3,15 +3,23 @@ include_once('./_common.php');
$g5['title'] = '배송지 목록';
include_once(G5_PATH.'/head.sub.php');
?>
<div class="new_win">
<h1 id="new_win_title"><?php echo $g5['title']; ?></h1>
$order_action_url = G5_HTTPS_SHOP_URL.'/orderaddressupdate.php';
?>
<form name="forderaddress" method="post" action="<?php echo $order_action_url; ?>" autocomplete="off">
<div id="sod_addr_list" class="new_win">
<h1 id="new_win_title">배송지 목록</h1>
<table class="basic_tbl">
<thead>
<tr>
<th scope="col">
<label for="chk_all" class="sound_only">전체선택</label><input type="checkbox" name="chk_all" id="chk_all">
</th>
<th scope="col">배송지명</th>
<th scope="col">기본<br>배송지</th>
<th scope="col">이름</th>
<th scope="col">전화번호</th>
<th scope="col">주소</th>
@ -25,13 +33,18 @@ include_once(G5_PATH.'/head.sub.php');
$addr = $row['ad_name'].$sep.$row['ad_tel'].$sep.$row['ad_hp'].$sep.$row['ad_zip1'].$sep.$row['ad_zip2'].$sep.$row['ad_addr1'].$sep.$row['ad_addr2'].$sep.$row['ad_subject'];
?>
<tr>
<td class="td_name"><?php echo $row['ad_subject']; ?></td>
<td class="td_chk"><label for="chk_<?php echo $i;?>" class="sound_only">배송지선택</label>
<input type="hidden" name="ad_id[<?php echo $i; ?>]" value="<?php echo $row['ad_id'];?>">
<input type="checkbox" name="chk[]" value="<?php echo $i;?>" id="chk_<?php echo $i;?>">
</td>
<td class="td_name"><input type="text" name="ad_subject[<?php echo $i; ?>]" id="ad_subject" class="frm_input" size="12" maxlength="20" value="<?php echo $row['ad_subject']; ?>"></td>
<td class="td_default"><label for="ad_default<?php echo $i;?>" class="sound_only">기본배송지</label><input type="radio" name="ad_default" value="<?php echo $row['ad_id'];?>" id="ad_default<?php echo $i;?>" <?php if($row['ad_default']) echo 'checked="checked"';?>></td>
<td class="td_smallname"><?php echo $row['ad_name']; ?></td>
<td class="td_bignum"><?php echo $row['ad_tel']; ?><br><?php echo $row['ad_hp']; ?></td>
<td><?php echo sprintf('%s %s', $row['ad_addr1'], $row['ad_addr2']); ?></td>
<td class="td_mng">
<input type="hidden" value="<?php echo $addr; ?>">
<button type="button" class="sel_address">선택</button>
<button type="button" class="sel_address btn_frmline">선택</button>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?w=d&amp;ad_id=<?php echo $row['ad_id']; ?>" class="del_address">삭제</a>
</td>
</tr>
@ -40,7 +53,13 @@ include_once(G5_PATH.'/head.sub.php');
?>
</tbody>
</table>
<div class="btn_list">
<input type="submit" name="act_button" value="선택수정" id="btn_submit">
</div>
</div>
</form>
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['PHP_SELF']}?$qstr&amp;page="); ?>
<script>
$(function() {
@ -75,6 +94,23 @@ $(function() {
$(".del_address").on("click", function() {
return confirm("배송지 목록을 삭제하시겠습니까?");
});
// 전체선택 부분
$("#chk_all").on("click", function() {
if($(this).is(":checked")) {
$("input[name^='chk[']").attr("checked", true);
} else {
$("input[name^='chk[']").attr("checked", false);
}
});
$("#btn_submit").on("click", function() {
if($("input[name^='chk[']:checked").length==0 ){
alert("수정하실 항목을 하나 이상 선택하세요.");
return false;
}
});
});
</script>

View File

@ -431,6 +431,11 @@ ob_end_clean();
// 배송지 이력
$addr_list = '';
$sep = chr(30);
// 주문자와 동일
$addr_list .= '<input type="radio" name="ad_sel_addr" value="same" id="ad_sel_addr_same">'.PHP_EOL;
$addr_list .= '<label for="ad_sel_addr_same">주문자와 동일</label>'.PHP_EOL;
// 기본배송지
$sql = " select *
from {$g5['g5_shop_order_address_table']}
@ -447,6 +452,7 @@ ob_end_clean();
$sql = " select *
from {$g5['g5_shop_order_address_table']}
where mb_id = '{$member['mb_id']}'
and ad_default = '0'
order by ad_id desc
limit 2 ";
$result = sql_query($sql);
@ -468,7 +474,11 @@ ob_end_clean();
</tr>
<tr>
<th scope="row"><label for="ad_subject">배송지명</label></th>
<td><input type="text" name="ad_subject" id="ad_subject" class="frm_input" maxlength="20"></td>
<td>
<input type="text" name="ad_subject" id="ad_subject" class="frm_input" maxlength="20">
<input type="checkbox" name="ad_default" id="ad_default" value="1">
<label for="ad_default">기본배송지로 설정</label>
</td>
</tr>
<?php
}
@ -1052,31 +1062,35 @@ $(function() {
$("input[name=ad_sel_addr]").on("click", function() {
var addr = $(this).val().split(String.fromCharCode(30));
if(addr[0] == "new") {
for(i=0; i<8; i++) {
addr[i] = "";
if (addr[0] == "same") {
gumae2baesong();
} else {
if(addr[0] == "new") {
for(i=0; i<8; i++) {
addr[i] = "";
}
}
}
var f = document.forderform;
f.od_b_name.value = addr[0];
f.od_b_tel.value = addr[1];
f.od_b_hp.value = addr[2];
f.od_b_zip1.value = addr[3];
f.od_b_zip2.value = addr[4];
f.od_b_addr1.value = addr[5];
f.od_b_addr2.value = addr[6];
f.ad_subject.value = addr[7];
var f = document.forderform;
f.od_b_name.value = addr[0];
f.od_b_tel.value = addr[1];
f.od_b_hp.value = addr[2];
f.od_b_zip1.value = addr[3];
f.od_b_zip2.value = addr[4];
f.od_b_addr1.value = addr[5];
f.od_b_addr2.value = addr[6];
f.ad_subject.value = addr[7];
var zip1 = addr[3].replace(/[^0-9]/g, "");
var zip2 = addr[4].replace(/[^0-9]/g, "");
var zip1 = addr[3].replace(/[^0-9]/g, "");
var zip2 = addr[4].replace(/[^0-9]/g, "");
if(zip1 != "" && zip2 != "") {
var code = String(zip1) + String(zip2);
if(zip1 != "" && zip2 != "") {
var code = String(zip1) + String(zip2);
if(zipcode != code) {
zipcode = code;
calculate_sendcost(code);
if(zipcode != code) {
zipcode = code;
calculate_sendcost(code);
}
}
}
});
@ -1469,8 +1483,10 @@ function payment_check(f)
}
// 구매자 정보와 동일합니다.
function gumae2baesong(f)
function gumae2baesong()
{
var f = document.forderform;
f.od_b_name.value = f.od_name.value;
f.od_b_tel.value = f.od_tel.value;
f.od_b_hp.value = f.od_hp.value;

View File

@ -581,21 +581,19 @@ if (get_session('ss_direct'))
set_session('ss_cart_direct', '');
// 배송지처리
if($is_member && ($add_address || $ad_default)) {
$ad_zip1 = $od_b_zip1;
$ad_zip2 = $od_b_zip2;
$ad_addr1 = $od_b_addr1;
$ad_addr2 = $od_b_addr2;
$sql = " select ad_id
from {$g5['g5_shop_order_address_table']}
if($is_member) {
$sql = " select * from {$g5['g5_shop_order_address_table']}
where mb_id = '{$member['mb_id']}'
and ad_zip1 = '$ad_zip1'
and ad_zip2 = '$ad_zip2'
and ad_addr1 = '$ad_addr1'
and ad_addr2 = '$ad_addr2' ";
and ad_name = '$od_b_name'
and ad_tel = '$od_b_tel'
and ad_hp = '$od_b_hp'
and ad_zip1 = '$od_b_zip1'
and ad_zip2 = '$od_b_zip2'
and ad_addr1 = '$od_b_addr1'
and ad_addr2 = '$od_b_addr2' ";
$row = sql_fetch($sql);
// 기본배송지 체크
if($ad_default) {
$sql = " update {$g5['g5_shop_order_address_table']}
set ad_default = '0'
@ -603,22 +601,13 @@ if($is_member && ($add_address || $ad_default)) {
sql_query($sql);
}
if($row['ad_id']) {
if($row['ad_id']){
$sql = " update {$g5['g5_shop_order_address_table']}
set ad_zip1 = '$ad_zip1',
ad_zip2 = '$ad_zip2',
ad_addr1 = '$ad_addr1',
ad_addr2 = '$ad_addr2' ";
if($ad_default)
$sql .= " , ad_default = '$ad_default' ";
if($ad_subject)
$sql .= " , ad_subject = '$ad_subject' ";
$sql .= " where ad_id = '{$row['ad_id']}'
and mb_id = '{$member['mb_id']}' ";
sql_query($sql);
}
if(!$row['ad_id'] && $add_address) {
set ad_default = '1',
ad_subject = '$ad_subject'
where mb_id = '{$member['mb_id']}'
and ad_id = '{$row['ad_id']}' ";
} else {
$sql = " insert into {$g5['g5_shop_order_address_table']}
set mb_id = '{$member['mb_id']}',
ad_subject = '$ad_subject',
@ -630,8 +619,9 @@ if($is_member && ($add_address || $ad_default)) {
ad_zip2 = '$od_b_zip2',
ad_addr1 = '$od_b_addr1',
ad_addr2 = '$od_b_addr2' ";
sql_query($sql);
}
sql_query($sql);
}
goto_url(G5_SHOP_URL.'/orderinquiryview.php?od_id='.$od_id.'&amp;uid='.$uid);

View File

@ -31,9 +31,6 @@ $sql = " select *
$result = sql_query($sql);
//$qstr = $qstr.'&amp;sca='.$sca.'&amp;page='.$page;
$qstr = $qstr.'&amp;sca='.$sca.'&amp;page='.$page.'&amp;save_stx='.$stx;
if(!mysql_num_rows($result))
alert_close('배송지 목록 자료가 없습니다.');
@ -49,8 +46,6 @@ $order_action_url = G5_HTTPS_SHOP_URL.'/orderaddressupdate.php';
?>
<form name="forderaddress" method="post" action="<?php echo $order_action_url; ?>" autocomplete="off">
<input type="hidden" name="page" value="<?php echo $page; ?>">
<input type="hidden" name="save_stx" value="<?php echo $stx; ?>">
<div id="sod_addr_list" class="new_win">
<h1 id="new_win_title">배송지 목록</h1>

View File

@ -664,7 +664,7 @@ function get_intall_file()
$sep = chr(30);
// 주문자와 동일
$addr_list .= '<input type="radio" name="ad_sel_addr" value="same">'.PHP_EOL;
$addr_list .= '<input type="radio" name="ad_sel_addr" value="same" id="ad_sel_addr_same">'.PHP_EOL;
$addr_list .= '<label for="ad_sel_addr_same">주문자와 동일</label>'.PHP_EOL;
// 기본배송지
@ -707,10 +707,8 @@ function get_intall_file()
<th scope="row"><label for="ad_subject">배송지명</label></th>
<td>
<input type="text" name="ad_subject" id="ad_subject" class="frm_input" maxlength="20">
<?php if ($addr_list) {
echo '<input type="checkbox" name="ad_default" id="ad_default" value="1">'.PHP_EOL.'
<label for="ad_default">기본배송지로 설정</label>';
}?>
<input type="checkbox" name="ad_default" id="ad_default" value="1">
<label for="ad_default">기본배송지로 설정</label>
</td>
</tr>
<?php