#301 주문 폼, 배송지관리 부분 수정
This commit is contained in:
@ -239,6 +239,10 @@ button.btn_frmline2 {font-size:1em;cursor:pointer}
|
||||
.btn_admin {display:inline-block;padding:0 10px;height:23px;border:1px solid #e8180c !important;background:#e8180c !important;color:#fff !important;text-decoration:none !important;line-height:2.15em;vertical-align:middle} /* 관리자 전용 버튼 */
|
||||
.btn_admin:focus, .btn_admin:hover {text-decoration:none !important}
|
||||
|
||||
/* 선택수정 버튼 */
|
||||
.btn_list {margin:0 auto;width:93%}
|
||||
.btn_list input, .btn_list button {background: none repeat scroll 0 0 #617D46;border: 0 none;color: #FFFFFF;height: 28px;line-height: 2.2em;padding: 0 15px;vertical-align: middle}
|
||||
|
||||
/* 기본테이블 */
|
||||
.basic_tbl {margin-bottom:10px;width:100%;border-collapse:collapse;border-spacing:0}
|
||||
.basic_tbl caption {margin:0;padding:0;font-size:0;line-height:0;overflow:hidden}
|
||||
@ -307,6 +311,7 @@ td.empty_table {padding:85px 0;text-align:center}
|
||||
.td_datetime {width:110px;text-align:center}
|
||||
.td_smallmng {width:50px;text-align:center}
|
||||
.td_mng {width:80px;text-align:center}
|
||||
.td_default {width:60px;text-align:center}
|
||||
|
||||
/* 새창 기본 스타일 */
|
||||
.new_win {}
|
||||
|
||||
@ -10,15 +10,30 @@ if($w == 'd') {
|
||||
goto_url($_SERVER['PHP_SELF']);
|
||||
}
|
||||
|
||||
$sql_common = " from {$g5['g5_shop_order_address_table']} ";
|
||||
|
||||
$sql = " select count(ad_id) as cnt " . $sql_common;
|
||||
$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 *
|
||||
from {$g5['g5_shop_order_address_table']}
|
||||
where mb_id = '{$member['mb_id']}'
|
||||
order by
|
||||
ad_default desc,
|
||||
ad_id desc ";
|
||||
ad_id desc
|
||||
limit $from_record, $rows";
|
||||
|
||||
$result = sql_query($sql);
|
||||
|
||||
//$qstr = $qstr.'&sca='.$sca.'&page='.$page;
|
||||
$qstr = $qstr.'&sca='.$sca.'&page='.$page.'&save_stx='.$stx;
|
||||
|
||||
if(!mysql_num_rows($result))
|
||||
alert_close('배송지 목록 자료가 없습니다.');
|
||||
|
||||
@ -33,7 +48,9 @@ include_once(G5_PATH.'/head.sub.php');
|
||||
$order_action_url = G5_HTTPS_SHOP_URL.'/orderaddress_update.php';
|
||||
|
||||
?>
|
||||
<form name="forderaddress" method="post" action="<?php echo $order_action_url; ?>" onsubmit="return fitemlist_submit(this);" autocomplete="off">
|
||||
<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>
|
||||
@ -63,7 +80,7 @@ $order_action_url = G5_HTTPS_SHOP_URL.'/orderaddress_update.php';
|
||||
<input type="hidden" name="ad_id[]" 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[]" id="ad_subject" class="frm_input" size="10" maxlength="20" value="<?php echo $row['ad_subject']; ?>"></td>
|
||||
<td class="td_name"><input type="text" name="ad_subject[]" 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>
|
||||
@ -80,28 +97,14 @@ $order_action_url = G5_HTTPS_SHOP_URL.'/orderaddress_update.php';
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="btn_list">
|
||||
<input type="submit" name="act_button" value="선택수정" onclick="document.pressed=this.value">
|
||||
<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&page="); ?>
|
||||
|
||||
<script>
|
||||
function fitemlist_submit(f)
|
||||
{
|
||||
if (!is_checked("chk[]")) {
|
||||
alert(document.pressed+" 하실 항목을 하나 이상 선택하세요.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(document.pressed == "선택삭제") {
|
||||
if(!confirm("선택한 자료를 정말 삭제하시겠습니까?")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
$(function() {
|
||||
$(".sel_address").on("click", function() {
|
||||
var addr = $(this).siblings("input").val().split(String.fromCharCode(30));
|
||||
@ -144,6 +147,13 @@ $(function() {
|
||||
}
|
||||
});
|
||||
|
||||
$("#btn_submit").on("click", function() {
|
||||
if( $(":checkbox:checked").length==0 ){
|
||||
alert("수정하실 항목을 하나 이상 선택하세요.");
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@ -1,33 +0,0 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
//print_r2($_POST); exit;
|
||||
|
||||
if ($is_member && count($_POST['chk'])) {
|
||||
|
||||
// 해당 회원에 대한 기본배송지 클리어
|
||||
if (isset($_POST['ad_default'])) {
|
||||
$sql = " update `{$g5['g5_shop_order_address_table']}`
|
||||
set ad_default = 0
|
||||
where mb_id = '{$member['mb_id']}' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
|
||||
for ($i=0; $i<count($_POST['chk']); $i++)
|
||||
{
|
||||
// 실제 번호를 넘김
|
||||
$k = $_POST['chk'][$i];
|
||||
|
||||
$sql = " update `{$g5['g5_shop_order_address_table']}`
|
||||
set ad_subject = '{$_POST['ad_subject'][$k]}' ";
|
||||
// 기본배송지로 선택 되었다면
|
||||
if ($_POST['ad_id'][$k] == $_POST['ad_default'])
|
||||
$sql .= " , ad_default = '1' ";
|
||||
$sql .= " where ad_id = '{$_POST['ad_id'][$k]}'
|
||||
and mb_id = '{$member['mb_id']}' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
goto_url(G5_SHOP_URL.'/orderaddress.php?od_id='.$od_id.'&uid='.$uid);
|
||||
?>
|
||||
47
shop/orderaddressupdate.php
Normal file
47
shop/orderaddressupdate.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
include_once('./_common.php');
|
||||
|
||||
if (!count($_POST['chk'])) {
|
||||
alert('수정하실 항목을 하나이상 선택하세요.');
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($is_member && count($_POST['chk'])) {
|
||||
|
||||
for ($i=0; $i<count($_POST['chk']); $i++)
|
||||
{
|
||||
// 실제 번호를 넘김
|
||||
$k = $_POST['chk'][$i];
|
||||
// 기본배송지 값이 안넘어올때 (기본배송지를 설정 안했을시)
|
||||
$sql = " update `{$g5['g5_shop_order_address_table']}` ";
|
||||
// 기본배송지 값이 있지만 선택한 배송지와 기존의 기본배송지가 다를때
|
||||
if ($_POST['ad_id'][$k] != $_POST['ad_default']){
|
||||
$sql .= " set ad_subject = '{$_POST['ad_subject'][$k]}'
|
||||
where ad_id = '{$_POST['ad_id'][$k]}'
|
||||
and mb_id = '{$member['mb_id']}' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
// 체크한 값이 기본배송지로 선택 되었다면
|
||||
else if ($_POST['ad_id'][$k] == $_POST['ad_default']){
|
||||
$sql .= " set ad_default = '0'
|
||||
where mb_id = '{$member['mb_id']}' ";
|
||||
sql_query($sql);
|
||||
|
||||
$sql = " update `{$g5['g5_shop_order_address_table']}`
|
||||
set ad_subject = '{$_POST['ad_subject'][$k]}',
|
||||
ad_default = '1'
|
||||
where ad_id = '{$_POST['ad_id'][$k]}'
|
||||
and mb_id = '{$member['mb_id']}' ";
|
||||
sql_query($sql);
|
||||
}else{
|
||||
$sql .= " set ad_subject = '{$_POST['ad_subject'][$k]}'
|
||||
where ad_id = '{$_POST['ad_id'][$k]}'
|
||||
and mb_id = '{$member['mb_id']}' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
goto_url(G5_SHOP_URL.'/orderaddress.php?od_id='.$od_id.'&uid='.$uid);
|
||||
?>
|
||||
@ -1299,7 +1299,7 @@ $(function() {
|
||||
// 배송지목록
|
||||
$("#order_address").on("click", function() {
|
||||
var url = this.href;
|
||||
window.open(url, "win_address", "left=100,top=100,width=800,height=500,scrollbars=1");
|
||||
window.open(url, "win_address", "left=100,top=100,width=800,height=600,scrollbars=1");
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
@ -577,75 +577,36 @@ if (get_session('ss_direct'))
|
||||
|
||||
// 배송지처리
|
||||
if($is_member) {
|
||||
$ad_zip1 = $od_b_zip1;
|
||||
$ad_zip2 = $od_b_zip2;
|
||||
$ad_addr1 = $od_b_addr1;
|
||||
$ad_addr2 = $od_b_addr2;
|
||||
|
||||
$sql = " select count(*) as count from {$g5['g5_shop_order_address_table']}
|
||||
$sql = " select * from {$g5['g5_shop_order_address_table']}
|
||||
where mb_id = '{$member['mb_id']}'
|
||||
and ad_subject = '{$_POST['od_b_subject']}'
|
||||
and ad_name = '{$_POST['od_b_name']}'
|
||||
and ad_tel = '{$_POST['od_b_tel']}'
|
||||
and ad_hp = '{$_POST['od_b_hp']}'
|
||||
and ad_zip1 = '{$_POST['od_b_zip1']}'
|
||||
and ad_zip2 = '{$_POST['od_b_zip2']}'
|
||||
and ad_addr1 = '{$_POST['od_b_addr1']}'
|
||||
and ad_addr2 = '{$_POST['od_b_addr2']}' ";
|
||||
and ad_name = '{$_POST['od_b_name']}'
|
||||
and ad_tel = '{$_POST['od_b_tel']}'
|
||||
and ad_hp = '{$_POST['od_b_hp']}'
|
||||
and ad_zip1 = '{$_POST['od_b_zip1']}'
|
||||
and ad_zip2 = '{$_POST['od_b_zip2']}'
|
||||
and ad_addr1 = '{$_POST['od_b_addr1']}'
|
||||
and ad_addr2 = '{$_POST['od_b_addr2']}' ";
|
||||
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
if(!$row['count']){
|
||||
$sql = " insert into {$g5['g5_shop_order_address_table']}
|
||||
set mb_id = '{$member['mb_id']}',
|
||||
ad_subject = '$ad_subject',
|
||||
ad_default = '$ad_default',
|
||||
ad_name = '$od_b_name',
|
||||
ad_tel = '$od_b_tel',
|
||||
ad_hp = '$od_b_hp',
|
||||
ad_zip1 = '$od_b_zip1',
|
||||
ad_zip2 = '$od_b_zip2',
|
||||
ad_addr1 = '$od_b_addr1',
|
||||
ad_addr2 = '$od_b_addr2' ";
|
||||
sql_query($sql);
|
||||
echo "됏다";
|
||||
}
|
||||
|
||||
|
||||
//print_r ($row);
|
||||
|
||||
$sql = " select ad_id
|
||||
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' ";
|
||||
$row = sql_fetch($sql);
|
||||
|
||||
// 기본배송지로 할시
|
||||
if($ad_default) {
|
||||
$sql = " update {$g5['g5_shop_order_address_table']}
|
||||
set ad_default = '0'
|
||||
where mb_id = '{$member['mb_id']}' ";
|
||||
sql_query($sql);
|
||||
|
||||
if($row['ad_id']){
|
||||
$sql = " update {$g5['g5_shop_order_address_table']}
|
||||
set ad_default = '1'
|
||||
where mb_id = '{$member['mb_id']}'
|
||||
and ad_id = '{$row['ad_id']}' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
// 카운트 된 값이 없으면 새로 배송지 추가 저장
|
||||
if(!$row['ad_id']){
|
||||
$sql = " insert into {$g5['g5_shop_order_address_table']}
|
||||
set mb_id = '{$member['mb_id']}',
|
||||
ad_subject = '$ad_subject',
|
||||
|
||||
Reference in New Issue
Block a user