#211 주문시 추가배송비 처리 코드 추가
This commit is contained in:
@ -294,6 +294,8 @@ ob_end_clean();
|
||||
<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 echo $content; ?>
|
||||
|
||||
@ -478,6 +480,10 @@ ob_end_clean();
|
||||
<tr>
|
||||
<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>
|
||||
@ -701,6 +707,7 @@ ob_end_clean();
|
||||
$(function() {
|
||||
var $cp_btn_el;
|
||||
var $cp_row_el;
|
||||
var zipcode = "";
|
||||
|
||||
$(".it_coupon_btn").click(function() {
|
||||
$cp_btn_el = $(this);
|
||||
@ -802,6 +809,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쿠폰을 적용하시겠습니까?")) {
|
||||
@ -811,8 +819,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();
|
||||
@ -828,11 +838,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() {
|
||||
@ -885,6 +900,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();
|
||||
@ -931,14 +961,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) { ?>
|
||||
@ -951,7 +989,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;
|
||||
|
||||
$("form[name=sm_form] input[name=good_mny]").val(tot_amount);
|
||||
$("#od_tot_amount").text(number_format(String(tot_amount)));
|
||||
@ -982,6 +1021,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 kcp_approval()
|
||||
{
|
||||
@ -1255,6 +1308,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>
|
||||
|
||||
|
||||
@ -64,6 +64,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'];
|
||||
|
||||
|
||||
@ -251,6 +252,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_sell_amount + $send_cost;
|
||||
// 회원이면서 포인트사용이면
|
||||
@ -271,7 +283,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)
|
||||
{
|
||||
@ -294,7 +306,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)
|
||||
{
|
||||
@ -303,7 +315,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 == "무통장")
|
||||
{
|
||||
@ -425,6 +437,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',
|
||||
|
||||
@ -116,6 +116,7 @@ include_once(G4_MSHOP_PATH.'/_head.php');
|
||||
}
|
||||
|
||||
$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;
|
||||
?>
|
||||
@ -124,7 +125,7 @@ include_once(G4_MSHOP_PATH.'/_head.php');
|
||||
<?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">
|
||||
@ -151,6 +152,11 @@ include_once(G4_MSHOP_PATH.'/_head.php');
|
||||
<dd class="sod_bsk_dvr"><strong><?php echo number_format($send_coupon); ?> 원</strong></dd>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($org_send_cost2 > 0) { ?>
|
||||
<dt class="sod_bsk_dvr">추가배송비</dt>
|
||||
<dd class="sod_bsk_dvr"><strong><?php echo number_format($org_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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user