#211 주문시 추가배송비 처리 코드 추가
This commit is contained in:
@ -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>
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -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>
|
||||
|
||||
|
||||
@ -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',
|
||||
|
||||
@ -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>
|
||||
|
||||
|
||||
@ -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
19
shop/ordersendcost.php
Normal 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']);
|
||||
?>
|
||||
Reference in New Issue
Block a user