Merge branch 'master' of github.com:gnuboard/yc4s

Conflicts:
	shop/item.php
	shop/itemqa.php
	shop/itemqaform.php
	shop/itemqaformupdate.php
This commit is contained in:
gnuboard
2013-06-18 11:03:20 +09:00
61 changed files with 1010 additions and 780 deletions

View File

@ -7,9 +7,6 @@ if (G4_IS_MOBILE) {
}
include_once(G4_LIB_PATH.'/iteminfo.lib.php');
include_once(G4_GCAPTCHA_PATH.'/gcaptcha.lib.php');
$captcha_html = captcha_html();
// 불법접속을 할 수 없도록 세션에 아무값이나 저장하여 hidden 으로 넘겨서 다음 페이지에서 비교함
$token = md5(uniqid(rand(), true));
@ -603,6 +600,7 @@ else
$("#itemqa").load("./itemqa.php", {it_id:"<?php echo $it_id; ?>"});
});
</script>
<<<<<<< HEAD
<?php
/*
@ -610,6 +608,8 @@ else
include_once('./itemqa.inc.php');
*/
?>
=======
>>>>>>> 8ba2a84198461168008549042bbfc2d01e738d03
</section>
<?php if ($default['de_baesong_content']) { // 배송정보 내용이 있다면 ?>

View File

@ -1,3 +1,4 @@
<<<<<<< HEAD
<?php
include_once('./_common.php');
include_once(G4_LIB_PATH.'/thumbnail.lib.php');
@ -195,4 +196,214 @@ $(function(){
<?php
include_once(G4_PATH.'/tail.sub.php');
?>
?>
=======
<?php
include_once('./_common.php');
$it_id = $_REQUEST['it_id'];
?>
<section id="sit_qa_list">
<h3>등록된 상품문의</h3>
<?php
$sql_common = " from {$g4['shop_item_qa_table']} where it_id = '$it_id' ";
// 테이블의 전체 레코드수만 얻음
$sql = " select COUNT(*) as cnt " . $sql_common;
$row = sql_fetch($sql);
$total_count = $row['cnt'];
$rows = 5;
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page == "") $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 레코드 구함
$sql = "select *
$sql_common
order by iq_id desc
limit $from_record, $rows ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$num = $total_count - ($page - 1) * $rows - $i;
$iq_name = get_text($row['iq_name']);
$iq_subject = conv_subject($row['iq_subject'],50, '…');
$iq_question = conv_content($row['iq_question'],0);
$iq_answer = conv_content($row['iq_answer'],0);
$iq_time = substr($row['iq_time'], 2, 14);
//$qa = "<img src='$g4[shop_img_path]/icon_poll_q.gif' border=0>";
//if ($row[iq_answer]) $qa .= "<img src='$g4[shop_img_path]/icon_answer.gif' border=0>";
//$qa = "$qa";
$iq_stats = '';
$iq_answer = '';
$iq_flag = 0;
if ($row['iq_answer'])
{
$iq_answer = conv_content($row['iq_answer'],0);
$iq_stats = '답변완료';
} else {
$iq_stats = '답변전';
$iq_answer = '답변이 등록되지 않았습니다.';
$iq_flag = 1;
}
if ($i == 0) echo '<ol id="sit_qa_ol">';
?>
<li class="sit_qa_li">
<button type="button" class="sit_qa_li_title" onclick="javascript:qa_menu('sit_qa_con_<?php echo $i; ?>')"><b><?php echo $num; ?>.</b> <?php echo $iq_subject; ?></button>
<dl class="sit_qa_dl">
<dt>작성자</dt>
<dd><?php echo $iq_name; ?></dd>
<dt>작성일</dt>
<dd><?php echo $iq_time; ?></dd>
<dt>상태</dt>
<dd><?php echo $iq_stats; ?></dd>
</dl>
<div id="sit_qa_con_<?php echo $i; ?>" class="sit_qa_con">
<p class="sit_qa_qaq">
<strong>문의내용</strong><br>
<?php echo $iq_question; // 상품 문의 내용 ?>
</p>
<p class="sit_qa_qaa">
<strong>답변</strong><br>
<?php echo $iq_answer; ?>
</p>
<textarea id="tmp_iq_id<?php echo $i; ?>"><?php echo $row['iq_id']; ?></textarea>
<textarea id="tmp_iq_name<?php echo $i; ?>"><?php echo $row['iq_name']; ?></textarea>
<textarea id="tmp_iq_subject<?php echo $i; ?>"><?php echo $row['iq_subject']; ?></textarea>
<textarea id="tmp_iq_question<?php echo $i; ?>"><?php echo $row['iq_question']; ?></textarea>
<?php if ($row['mb_id'] == $member['mb_id'] && $iq_answer == 0) { ?>
<div class="sit_qa_cmd">
<a href="./itemqaform.php?w=u&amp;it_id=<?php echo $it_id; ?>&amp;iq_id=<?php echo $row['iq_id']; ?>" class="itemqa_mod btn01">수정</a>
<a href="./itemqaformupdate.php?w=d&amp;it_id=<?php echo $it_id; ?>&amp;iq_id=<?php echo $row['iq_id']; ?>" class="itemqa_del btn01">삭제</a>
</div>
<?php } ?>
</div>
</li>
<?php }
if ($i >= 0) echo '</ol>';
if (!$i) echo '<p class="sit_empty">상품문의가 없습니다.</p>';
?>
</section>
<?php
// 현재페이지, 총페이지수, 한페이지에 보여줄 행, URL
function itemqa_page($write_pages, $cur_page, $total_page, $url, $add="")
{
$url = preg_replace('#&amp;page=[0-9]*(&amp;page=)$#', '$1', $url);
$str = '';
if ($cur_page > 1) {
$str .= '<a href="'.$url.'1'.$add.'" class="qa_page qa_start" onclick="return false;">처음</a>'.PHP_EOL;
}
$start_page = ( ( (int)( ($cur_page - 1 ) / $write_pages ) ) * $write_pages ) + 1;
$end_page = $start_page + $write_pages - 1;
if ($end_page >= $total_page) $end_page = $total_page;
if ($start_page > 1) $str .= '<a href="'.$url.($start_page-1).$add.'" class="qa_page qa_prev" onclick="return false;">이전</a>'.PHP_EOL;
if ($total_page > 1) {
for ($k=$start_page;$k<=$end_page;$k++) {
if ($cur_page != $k)
$str .= '<a href="'.$url.$k.$add.'" class="qa_page" onclick="return false;">'.$k.'</a><span class="sound_only">페이지</span>'.PHP_EOL;
else
$str .= '<span class="sound_only">열린</span><strong class="qa_current">'.$k.'</strong><span class="sound_only">페이지</span>'.PHP_EOL;
}
}
if ($total_page > $end_page) $str .= '<a href="'.$url.($end_page+1).$add.'" class="qa_page qa_next">다음</a>'.PHP_EOL;
if ($cur_page < $total_page) {
$str .= '<a href="'.$url.$total_page.$add.'" class="qa_page qa_end" onclick="return false;">맨끝</a>'.PHP_EOL;
}
if ($str)
return "<nav class=\"qa_wrap\"><span class=\"qa\">{$str}</span></nav>";
else
return "";
}
echo itemqa_page($config['cf_write_pages'], $page, $total_page, "./itemqa.php?it_id=$it_id&amp;page=", "");
?>
<div id="sit_qa_wbtn">
<a href="./itemqaform.php?it_id=<?php echo $it_id; ?>" id="itemqa_form" class="btn02">상품문의 쓰기</a>
</div>
<script>
$(function(){
$("#itemqa_form").click(function(){
window.open(this.href, "itemqa_form", "width=800,height=550");
return false;
});
$(".itemqa_mod").live("click", function() {
window.open(this.href, "itemqa_form", "width=800,height=550");
return false;
});
$(".itemqa_del").live("click", function() {
if(!confirm("상품문의를 삭제하시겠습니까?"))
return false;
<?php if($is_member) { ?>
document.location.href = this.href;
<?php } else { ?>
var iq_pass_frm = "<div id=\"iq_password_frm\">";
iq_pass_frm += "<form name=\"fitemqapass\" method=\"post\" action=\""+this.href+"\">";
iq_pass_frm += "<label for=\"iq_password\">비밀번호</label>";
iq_pass_frm += "<input type=\"password\" name=\"iq_password\" id=\"iq_password\" size=\"20\">";
iq_pass_frm += "<input type=\"submit\" value=\"확인\">";
iq_pass_frm += "</form>";
iq_pass_frm += "</div>";
$("#iq_password_frm").remove();
$(this).after(iq_pass_frm);
return false;
<?php } ?>
});
$("form[name=fitemqapass]").live("submit", function() {
var pass = trim($("input[name=iq_password]").val());
if(pass == "") {
alert("비밀번호를 입력해 주십시오.");
return false;
}
return true;
});
$(".qa_href").click(function(){
var $content = $("#qa_div"+$(this).attr("target"));
$(".qa_div").each(function(index, value){
if ($(this).get(0) == $content.get(0)) { // 객체의 비교시 .get(0) 를 사용한다.
$(this).is(":hidden") ? $(this).show() : $(this).hide();
} else {
$(this).hide();
}
});
});
$(".qa_page").click(function(){
//alert($(this).attr("href"));
$(top.document).find('#itemqa').load($(this).attr("href"));
});
});
</script>
>>>>>>> 8ba2a84198461168008549042bbfc2d01e738d03

View File

@ -1,3 +1,4 @@
<<<<<<< HEAD
<?php
include_once("./_common.php");
include_once(G4_CKEDITOR_PATH.'/ckeditor.lib.php');
@ -79,4 +80,79 @@ $(function() {
<?php
include_once(G4_PATH.'/tail.sub.php');
=======
<?php
include_once('./_common.php');
include_once(G4_GCAPTCHA_PATH.'/gcaptcha.lib.php');
$captcha_html = captcha_html();
$w = escape_trim($_REQUEST['w']);
$it_id = escape_trim($_REQUEST['it_id']);
$iq_id = escape_trim($_REQUEST['iq_id']);
if($w == 'u') {
$sql = " select * from {$g4['shop_item_qa_table']} where it_id = '$it_id' and iq_id = '$iq_id' ";
$qa = sql_fetch($sql);
}
include_once(G4_PATH.'/head.sub.php');
?>
<div>
<form name="fitemqa" method="post" action="./itemqaformupdate.php" onsubmit="return fitemqa_submit(this);" autocomplete="off">
<input type="hidden" name="w" value="<?php echo $w; ?>">
<input type="hidden" name="iq_id" value="<?php echo $iq_id; ?>">
<input type="hidden" name="it_id" value="<?php echo $it_id; ?>">
<table class="frm_tbl">
<colgroup>
<col class="grid_3">
<col>
</colgroup>
<tbody>
<?php if (!$is_member) { ?>
<tr>
<th scope="row"><label for="iq_name">이름</label></th>
<td><input type="text" name="iq_name" id="iq_name" value="<?php echo $qa['iq_name']; ?>" required class="frm_input" maxlength="20" minlength="2"></td>
</tr>
<tr>
<th scope="row"><label for="iq_password">패스워드</label></th>
<td>
<span class="frm_info">패스워드는 최소 3글자 이상 입력하십시오.</span>
<input type="password" name="iq_password" id="iq_password" required class="frm_input" maxlength="20" minlength="3">
</td>
</tr>
<?php } ?>
<tr>
<th scope="row"><label for="iq_subject">제목</label></th>
<td><input type="text" name="iq_subject" id="iq_subject" value="<?php echo $qa['iq_subject']; ?>" required class="frm_input" size="71" maxlength="100"></td>
</tr>
<tr>
<th scope="row"><label for="iq_question">내용</label></th>
<td><textarea name="iq_question" id="iq_question" required><?php echo $qa['iq_question']; ?></textarea></td>
</tr>
<tr>
<th scope="row">자동등록방지</th>
<td><?php echo $captcha_html; ?></td>
</tr>
</tbody>
</table>
<div class="btn_confirm">
<input type="submit" value="작성완료" class="btn_submit">
</div>
</form>
</div>
<script>
function fitemqa_submit(f)
{
<?php echo chk_captcha_js(); ?>
return true;
}
</script>
<?php
include_once(G4_PATH.'/tail.sub.php');
>>>>>>> 8ba2a84198461168008549042bbfc2d01e738d03
?>

View File

@ -1,5 +1,6 @@
<?php
include_once('./_common.php');
<<<<<<< HEAD
if (!$is_member) {
alert_close("상품문의는 회원만 작성이 가능합니다.");
@ -17,12 +18,53 @@ if ($w == "" || $w == "u") {
if (!$iq_subject) alert("제목을 입력하여 주십시오.");
if (!$iq_question) alert("질문을 입력하여 주십시오.");
=======
include_once(G4_GCAPTCHA_PATH.'/gcaptcha.lib.php');
if ($w == '' || $w == 'u')
{
if (!chk_captcha()) {
alert('자동등록방지 숫자가 틀렸습니다.');
}
if (!$is_member)
{
if (!trim($_POST['iq_name'])) alert('이름을 입력하여 주십시오.');
if (!trim($_POST['iq_password'])) alert('패스워드를 입력하여 주십시오.');
}
else
{
$iq_name = $member['mb_name'];
$iq_password = $member['mb_password'];
}
$iq_password = sql_password($iq_password);
if (!trim($_POST['iq_subject'])) alert('제목을 입력하여 주십시오.');
if (!trim($_POST['iq_question'])) alert('내용을 입력하여 주십시오.');
>>>>>>> 8ba2a84198461168008549042bbfc2d01e738d03
}
$url = "./item.php?it_id=$it_id";
<<<<<<< HEAD
if ($w == "")
{
=======
if ($w == '')
{
$sql = " select max(iq_id) as max_iq_id from {$g4['shop_item_qa_table']} ";
$row = sql_fetch($sql);
$max_iq_id = $row['max_iq_id'];
$sql = " select max(iq_id) as max_iq_id from {$g4['shop_item_qa_table']}
where it_id = '$it_id'
and mb_id = '{$member['mb_id']}' ";
$row = sql_fetch($sql);
if ($row['max_iq_id'] && $row['max_iq_id'] == $max_iq_id)
alert('같은 상품에 대하여 계속해서 질문 하실 수 없습니다.');
>>>>>>> 8ba2a84198461168008549042bbfc2d01e738d03
$sql = "insert {$g4['shop_item_qa_table']}
set it_id = '$it_id',
mb_id = '{$member['mb_id']}',
@ -34,14 +76,24 @@ if ($w == "")
iq_ip = '$REMOTE_ADDR' ";
sql_query($sql);
<<<<<<< HEAD
alert_opener("상품문의가 등록 되었습니다.", $url);
}
else if ($w == "u")
=======
alert_opener('상품문의가 등록되었습니다.', $url);
}
else if ($w == 'u')
>>>>>>> 8ba2a84198461168008549042bbfc2d01e738d03
{
$sql = " select iq_password from {$g4['shop_item_qa_table']} where iq_id = '$iq_id' ";
$row = sql_fetch($sql);
if ($row['iq_password'] != $iq_password)
<<<<<<< HEAD
alert("패스워드가 틀리므로 수정하실 수 없습니다.");
=======
alert('패스워드가 틀리므로 수정하실 수 없습니다.');
>>>>>>> 8ba2a84198461168008549042bbfc2d01e738d03
$sql = " update {$g4['shop_item_qa_table']}
set iq_subject = '$iq_subject',
@ -49,15 +101,24 @@ else if ($w == "u")
where iq_id = '$iq_id' ";
sql_query($sql);
<<<<<<< HEAD
alert_opener("상품문의가 수정 되었습니다.", $url);
}
else if ($w == "d")
{
if (!$is_admin)
=======
alert_opener('상품문의가 수정되었습니다.', $url);
}
else if ($w == 'd')
{
if ($is_member)
>>>>>>> 8ba2a84198461168008549042bbfc2d01e738d03
{
$sql = " select count(*) as cnt from {$g4['shop_item_qa_table']} where mb_id = '{$member['mb_id']}' and iq_id = '$iq_id' ";
$row = sql_fetch($sql);
if (!$row['cnt'])
<<<<<<< HEAD
alert("자신의 상품문의만 삭제하실 수 있습니다.");
}
@ -66,5 +127,23 @@ else if ($w == "d")
sql_query($sql);
alert("상품문의가 삭제 되었습니다.", $url);
=======
die('자신의 상품문의만 삭제하실 수 있습니다.');
}
else
{
$iq_password = sql_password($iq_password);
$sql = " select iq_password from {$g4['shop_item_qa_table']} where iq_id = '$iq_id' ";
$row = sql_fetch($sql);
if ($row['iq_password'] != $iq_password)
die('패스워드가 틀리므로 삭제하실 수 없습니다.');
}
$sql = " delete from {$g4['shop_item_qa_table']} where mb_id = '{$member['mb_id']}' and iq_id = '$iq_id' ";
sql_query($sql);
goto_url($url);
>>>>>>> 8ba2a84198461168008549042bbfc2d01e738d03
}
?>

View File

@ -7,7 +7,7 @@ $it_id = $_REQUEST['it_id'];
$itemuse_form = "./itemuseform.php?it_id=".$it_id;
$itemuse_list = "./itemuselist.php";
include_once(G4_PATH.'/head.sub.php');
//include_once(G4_PATH.'/head.sub.php');
?>
<section id="sit_use_list">
@ -15,7 +15,7 @@ include_once(G4_PATH.'/head.sub.php');
<?php
/*
여분필드 용도
여분필드 용도
wr_1 : 상품코드
wr_2 : 상품명
wr_3 : 평점 1~5
@ -118,19 +118,20 @@ function itemuse_page($write_pages, $cur_page, $total_page, $url, $add="")
return "";
}
echo itemuse_page(10, $page, $total_page, "./itemuse.php?it_id=$it_id&amp;page=", "");
echo itemuse_page($config['cf_write_pages'], $page, $total_page, "./itemuse.php?it_id=$it_id&amp;page=", "");
?>
<div id="sit_use_wbtn">
<!-- <a href="javascript:itemusewin('it_id=<?php echo $it_id; ?>');">사용후기 쓰기<span class="sound_only"> 새 창</span></a> -->
<a href="<?php echo $itemuse_form; ?>" id="itemuse_form" onclick="return false;" class="btn02">사용후기 쓰기<span class="sound_only"> 새 창</span></a>
<a href="<?php echo $itemuse_form; ?>" id="itemuse_form" class="btn02">사용후기 쓰기<span class="sound_only"> 새 창</span></a>
<a href="<?php echo $itemuse_list; ?>" id="itemuse_list" class="btn01">더보기</a>
</div>
<script>
$(function(){
$("#itemuse_form").click(function(){
window.open(this.href, "itemuse_form", "width=800,height=550");
window.open(this.href, "itemuse_form", "width=800,height=550");
return false;
});
$(".use_href").click(function(){
@ -152,5 +153,5 @@ $(function(){
</script>
<?php
include_once(G4_PATH.'/tail.sub.php');
//include_once(G4_PATH.'/tail.sub.php');
?>

View File

@ -1,5 +1,11 @@
<?php
include_once("./_common.php");
include_once('./_common.php');
if (G4_IS_MOBILE) {
include_once(G4_MSHOP_PATH.'/itemuseform.php');
return;
}
include_once(G4_CKEDITOR_PATH.'/ckeditor.lib.php');
// 사용후기의 내용에 쓸수 있는 최대 글자수 (한글은 영문3자)
@ -90,7 +96,7 @@ function fitemuse_submit(f)
if (is_content_editor_data.length > <?php echo $is_content_max_length; ?>) {
alert("내용은 <?php echo $is_content_max_length; ?> 글자 이내에서 작성해 주세요. (한글은 영문 3자)\n\n현재 : "+is_content_editor_data.length+" 글자");
CKEDITOR.instances.is_content.focus();
CKEDITOR.instances.is_content.focus();
return false;
}

View File

@ -1,5 +1,11 @@
<?php
include_once('./_common.php');
if (G4_IS_MOBILE) {
include_once(G4_MSHOP_PATH.'/itemuselist.php');
return;
}
include_once(G4_LIB_PATH.'/thumb.lib.php');
$sfl = escape_trim($_REQUEST['sfl']);

View File

@ -65,6 +65,13 @@ $ft_a_st = 'display:block;padding:30px 0;background:#484848;color:#fff;text-alig
</tr>
<?php } ?>
<?php if ($od_send_cost2 > 0) { // 추가배송비가 있다면 ?>
<tr>
<th scope="row" style="<?php echo $th_st; ?>">추가배송비</th>
<td style="<?php echo $td_st; ?>"><?php echo display_price($od_send_cost2); ?></td>
</tr>
<?php } ?>
<tr>
<th scope="row" style="<?php echo $th_st; ?>">주문합계</th>
<td style="<?php echo $td_st; ?>"><?php echo display_price($ttotal_amount); ?></td>

View File

@ -65,6 +65,13 @@ $ft_a_st = 'display:block;padding:30px 0;background:#484848;color:#fff;text-alig
</tr>
<?php } ?>
<?php if ($od_send_cost2 > 0) { // 추가배송비가 있다면 ?>
<tr>
<th scope="row" style="<?php echo $th_st; ?>">추가배송비</th>
<td style="<?php echo $td_st; ?>"><?php echo display_price($od_send_cost2); ?></td>
</tr>
<?php } ?>
<tr>
<th scope="row" style="<?php echo $th_st; ?>">주문합계</th>
<td style="<?php echo $td_st; ?>"><?php echo display_price($ttotal_amount); ?></td>

View File

@ -299,6 +299,8 @@ setTimeout("init_pay_button();",300);
<input type="hidden" name="org_od_amount" value="<?php echo $tot_sell_amount; ?>">
<input type="hidden" name="od_send_cost" value="<?php echo $send_cost; ?>">
<input type="hidden" name="org_send_cost" value="<?php echo $send_cost; ?>">
<input type="hidden" name="od_send_cost2" value="0">
<input type="hidden" name="item_coupon" value="0">
<?php
/* ============================================================================== */
@ -699,6 +701,10 @@ setTimeout("init_pay_button();",300);
<th>총 주문금액</th>
<td><span id="od_tot_amount"><?php echo number_format($tot_amount); ?></span>원</td>
</tr>
<tr>
<th>추가배송비</th>
<td><span id="od_send_cost2">0</span>원 (지역에 따라 추가되는 도선료 등의 배송비입니다.)</td>
</tr>
</tbody>
</table>
@ -905,6 +911,7 @@ setTimeout("init_pay_button();",300);
$(function() {
var $cp_btn_el;
var $cp_row_el;
var zipcode = "";
$(".it_coupon_btn").click(function() {
$cp_btn_el = $(this);
@ -1006,6 +1013,7 @@ $(function() {
var subj = $el.find("input[name='o_cp_subj[]']").val();
var od_amount = parseInt($("input[name=org_od_amount]").val());
var send_cost = $("input[name=org_send_cost]").val();
var item_coupon = parseInt($("input[name=item_coupon]").val());
if(parseInt(amount) == 0) {
if(!confirm(subj+"쿠폰의 할인 금액은 "+amount+"원입니다.\n쿠폰을 적용하시겠습니까?")) {
@ -1015,8 +1023,10 @@ $(function() {
$("input[name=od_send_cost]").val(send_cost);
$("input[name=sc_cp_id]").val("");
$("#sc_coupon_btn").text("쿠폰적용");
$("#sc_coupon_cancel").remove();
$("input[name=od_amount]").val(od_amount - amount);
$("input[name=od_amount]").val(od_amount - item_coupon - amount);
$("input[name=od_cp_id]").val(cp_id);
calculate_order_amount();
$("#od_coupon_frm").remove();
@ -1032,11 +1042,16 @@ $(function() {
$("#od_coupon_cancel").live("click", function() {
var org_amount = $("input[name=org_od_amount]").val();
$("input[name=od_amount]").val(org_amount);
var item_coupon = parseInt($("input[name=item_coupon]").val());
$("input[name=od_amount]").val(org_amount - item_coupon);
$("input[name=od_send_cost]").val($("input[name=org_send_cost]").val());
$("input[name=sc_cp_id]").val("");
calculate_order_amount();
$("#od_coupon_frm").remove();
$("#od_coupon_btn").text("쿠폰적용").focus();
$(this).remove();
$("#sc_coupon_btn").text("쿠폰적용");
$("#sc_coupon_cancel").remove();
});
$("#sc_coupon_btn").click(function() {
@ -1089,6 +1104,21 @@ $(function() {
$(this).remove();
});
$("#od_b_addr2").focus(function() {
var zip1 = $("#od_b_zip1").val().replace(/[^0-9]/g, "");
var zip2 = $("#od_b_zip2").val().replace(/[^0-9]/g, "");
if(zip1 == "" || zip2 == "")
return false;
var code = String(zip1) + String(zip2);
if(zipcode == code)
return false;
zipcode = code;
calculate_sendcost(code);
});
$("#od_settle_bank").bind("click", function() {
$("[name=od_deposit_name]").val( $("[name=od_b_name]").val() );
$("#settle_bank").show();
@ -1131,14 +1161,22 @@ function calculate_total_amount()
$("#ct_tot_amount").text(number_format(String(tot_sell_amount))+" 원");
$("input[name=good_mny]").val(tot_sell_amount);
$("input[name=od_amount]").val(sell_amount);
$("input[name=org_od_amount]").val(sell_amount);
$("input[name=od_amount]").val(sell_amount - tot_cp_amount);
$("input[name=od_send_cost]").val(send_cost);
<?php if($od_cnt > 0) { ?>
$("input[name=item_coupon]").val(tot_cp_amount);
<?php if($oc_cnt > 0) { ?>
$("input[name=od_cp_id]").val("");
if($("#od_coupon_cancel").size()) {
$("#od_coupon_btn").text("쿠폰적용");
$("#od_coupon_cancel").remove();
}
<?php } ?>
<?php if($sc_cnt > 0) { ?>
$("input[name=sc_cp_id]").val("");
if($("#sc_coupon_cancel").size()) {
$("#sc_coupon_btn").text("쿠폰적용");
$("#sc_coupon_cancel").remove();
}
<?php } ?>
$("input[name=od_temp_point]").val(0);
<?php if($temp_point > 0 && $is_member) { ?>
@ -1151,7 +1189,8 @@ function calculate_order_amount()
{
var sell_amount = parseInt($("input[name=od_amount]").val());
var send_cost = parseInt($("input[name=od_send_cost]").val());
var tot_amount = sell_amount + send_cost;
var send_cost2 = parseInt($("input[name=od_send_cost2]").val());
var tot_amount = sell_amount + send_cost + send_cost2;
$("input[name=good_mny]").val(tot_amount);
$("#od_tot_amount").text(number_format(String(tot_amount)));
@ -1182,6 +1221,20 @@ function calculate_temp_point()
$("input[name=max_temp_point]").val(temp_point);
}
function calculate_sendcost(code)
{
$.post(
"./ordersendcost.php",
{ zipcode: code },
function(data) {
$("input[name=od_send_cost2]").val(data);
$("#od_send_cost2").text(number_format(String(data)));
calculate_order_amount();
}
);
}
function forderform_check(f)
{
errmsg = "";
@ -1394,6 +1447,8 @@ function gumae2baesong(f)
f.od_b_zip2.value = f.od_zip2.value;
f.od_b_addr1.value = f.od_addr1.value;
f.od_b_addr2.value = f.od_addr2.value;
calculate_sendcost(String(f.od_b_zip1.value) + String(f.od_b_zip2.value));
}
</script>

View File

@ -58,6 +58,7 @@ if ($error != "")
$i_amount = (int)$_POST['od_amount'];
$i_send_cost = (int)$_POST['od_send_cost'];
$i_send_cost2 = (int)$_POST['od_send_cost2'];
$i_temp_point = (int)$_POST['od_temp_point'];
@ -245,6 +246,17 @@ if ((int)($send_cost - $tot_sc_cp_amount) !== $i_send_cost) {
die("Error..");
}
// 추가배송비가 상이함
$zipcode = $od_b_zip1 . $od_b_zip2;
$sql = " select sc_id, sc_amount from {$g4['shop_sendcost_table']} where sc_zip1 <= '$zipcode' and sc_zip2 >= '$zipcode' ";
$tmp = sql_fetch($sql);
if(!$tmp['sc_id'])
$send_cost2 = 0;
else
$send_cost2 = (int)$tmp['sc_amount'];
if($send_cost2 !== $i_send_cost2)
die("Error...");
// 결제포인트가 상이함
$tot_amount = $tot_od_amount + ($send_cost - $tot_sc_cp_amount);
// 회원이면서 포인트사용이면
@ -265,7 +277,7 @@ if($default['de_mileage_use']) {
}
if (($i_temp_point > (int)$temp_point || $i_temp_point < 0))
die("Error...");
die("Error....");
if ($od_temp_point)
{
@ -288,7 +300,7 @@ if($default['de_mileage_use']) {
}
if (($i_temp_point > (int)$temp_point || $i_temp_point < 0) && $config['cf_use_point'])
die("Error...");
die("Error....");
if ($od_temp_point)
{
@ -297,7 +309,7 @@ if($default['de_mileage_use']) {
}
}
$i_amount = $i_amount + $i_send_cost - $i_temp_point;
$i_amount = $i_amount + $i_send_cost + $i_send_cost2 - $i_temp_point;
if ($od_settle_case == "무통장")
{
@ -419,6 +431,7 @@ $sql = " insert {$g4['shop_order_table']}
od_memo = '$od_memo',
od_send_cost = '$od_send_cost',
od_send_coupon = '$tot_sc_cp_amount',
od_send_cost2 = '$od_send_cost2',
od_coupon = '$tot_od_cp_amount',
od_temp_amount = '$od_temp_amount',
od_temp_point = '$od_temp_point',

View File

@ -128,6 +128,7 @@ if(openwin != null) {
}
$send_cost = $od['od_send_cost'];
$send_cost2 = $od['od_send_cost2'];
$send_coupon = $od['od_send_coupon'];
$org_send_cost = $send_cost + $send_coupon;
?>
@ -136,7 +137,7 @@ if(openwin != null) {
<?php
// 총계 = 주문상품금액합계 + 배송비 - 상품할인 - 결제할인
$od_coupon = $od['od_coupon'];
$tot_amount = $tot_sell_amount + $send_cost - $tot_cp_amount - $od_coupon;
$tot_amount = $tot_sell_amount + $send_cost + $send_cost2 - $tot_cp_amount - $od_coupon;
?>
<dl id="sod_bsk_tot">
@ -163,6 +164,11 @@ if(openwin != null) {
<dd class="sod_bsk_dvr"><strong><?php echo number_format($send_coupon); ?> 원</strong></dd>
<?php } ?>
<?php if ($send_cost2 > 0) { ?>
<dt class="sod_bsk_dvr">추가배송비</dt>
<dd class="sod_bsk_dvr"><strong><?php echo number_format($send_cost2); ?> 원</strong></dd>
<?php } ?>
<dt class="sod_bsk_cnt">총계</dt>
<dd class="sod_bsk_cnt"><strong><?php echo number_format($tot_amount); ?> 원</strong></dd>

View File

@ -71,4 +71,8 @@ for ($i=0; $row=sql_fetch_array($result); $i++)
// 배송비가 있다면 총계에 더한다
if ($od_send_cost)
$ttotal_amount += $od_send_cost;
// 추가배송비가 있다면 총계에 더한다
if ($od_send_cost2)
$ttotal_amount += $od_send_cost2;
?>

19
shop/ordersendcost.php Normal file
View File

@ -0,0 +1,19 @@
<?php
include_once('./_common.php');
$code = $_POST['zipcode'];
if(!$code)
die('0');
$sql = " select sc_id, sc_amount
from {$g4['shop_sendcost_table']}
where sc_zip1 <= $code
and sc_zip2 >= $code ";
$row = sql_fetch($sql);
if(!$row['sc_id'])
die('0');
die($row['sc_amount']);
?>