배송비 계산 get_sendcost 함수 추가
This commit is contained in:
@ -1502,6 +1502,50 @@ function get_item_point($it)
|
||||
return $it_point;
|
||||
}
|
||||
|
||||
// 배송비 구함
|
||||
function get_sendcost($price, $cart_id, $selected=1)
|
||||
{
|
||||
global $default, $g4;
|
||||
|
||||
if ($default['de_send_cost_case'] == '없음') {
|
||||
$send_cost = 0;
|
||||
} else if($default['de_send_cost_case'] == '상한') {
|
||||
// 배송비 상한 : 여러단계의 배송비 적용 가능
|
||||
$send_cost_limit = explode(";", $default['de_send_cost_limit']);
|
||||
$send_cost_list = explode(";", $default['de_send_cost_list']);
|
||||
$send_cost = 0;
|
||||
for ($k=0; $k<count($send_cost_limit); $k++) {
|
||||
// 총판매금액이 배송비 상한가 보다 작다면
|
||||
if ($price < preg_replace('/[^0-9]/', '', $send_cost_limit[$k])) {
|
||||
$send_cost = preg_replace('/[^0-9]/', '', $send_cost_list[$k]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else { // 개별배송비
|
||||
$send_cost = 0;
|
||||
$sql = " select distinct it_id
|
||||
from {$g4['shop_cart_table']}
|
||||
where od_id = '$cart_id'
|
||||
and ct_send_cost = '0'
|
||||
and ct_select = '$selected' ";
|
||||
|
||||
$result = sql_query($sql);
|
||||
for($i=0; $sc=sql_fetch_array($result); $i++) {
|
||||
// 합계
|
||||
$sql = " select SUM(IF(io_type = 1, (io_price * ct_qty), ((ct_price + io_price) * ct_qty))) as price,
|
||||
SUM(ct_qty) as qty
|
||||
from {$g4['shop_cart_table']}
|
||||
where it_id = '{$sc['it_id']}'
|
||||
and od_id = '$cart_id' ";
|
||||
$sum = sql_fetch($sql);
|
||||
|
||||
$send_cost += get_item_sendcost($sc['it_id'], $sum['price'], $sum['qty']);
|
||||
}
|
||||
}
|
||||
|
||||
return $send_cost;
|
||||
}
|
||||
|
||||
// 상품별 배송비
|
||||
function get_item_sendcost($it_id, $price, $qty)
|
||||
{
|
||||
|
||||
@ -75,11 +75,6 @@ include_once(G4_MSHOP_PATH.'/_head.php');
|
||||
$it_name .= '<div class="sod_bsk_itopt">'.$it_options.'</div>';
|
||||
}
|
||||
|
||||
// 개별배송비 계산
|
||||
if($default['de_send_cost_case'] == '개별' && !$row['ct_send_cost']) {
|
||||
$it_send_cost += get_item_sendcost($row['it_id'], $sum['price'], $sum['qty']);
|
||||
}
|
||||
|
||||
$point = $sum['point'];
|
||||
$sell_price = $sum['price'];
|
||||
?>
|
||||
@ -108,23 +103,7 @@ include_once(G4_MSHOP_PATH.'/_head.php');
|
||||
echo '<tr><td colspan="7" class="empty_table">장바구니에 담긴 상품이 없습니다.</td></tr>';
|
||||
} else {
|
||||
// 배송비 계산
|
||||
if ($default['de_send_cost_case'] == '없음')
|
||||
$send_cost = 0;
|
||||
else if($default['de_send_cost_case'] == '상한') {
|
||||
// 배송비 상한 : 여러단계의 배송비 적용 가능
|
||||
$send_cost_limit = explode(";", $default['de_send_cost_limit']);
|
||||
$send_cost_list = explode(";", $default['de_send_cost_list']);
|
||||
$send_cost = 0;
|
||||
for ($k=0; $k<count($send_cost_limit); $k++) {
|
||||
// 총판매금액이 배송비 상한가 보다 작다면
|
||||
if ($tot_sell_price < preg_replace('/[^0-9]/', '', $send_cost_limit[$k])) {
|
||||
$send_cost = preg_replace('/[^0-9]/', '', $send_cost_list[$k]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$send_cost = $it_send_cost;
|
||||
}
|
||||
$send_cost = get_sendcost($tot_sell_price, $s_cart_id, 0);
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
@ -130,11 +130,6 @@ ob_start();
|
||||
$it_name .= '<div class="sod_bsk_itopt">'.$it_options.'</div>';
|
||||
}
|
||||
|
||||
// 개별배송비 계산
|
||||
if($default['de_send_cost_case'] == '개별' && !$row['ct_send_cost']) {
|
||||
$it_send_cost += get_item_sendcost($row['it_id'], $sum['price'], $sum['qty']);
|
||||
}
|
||||
|
||||
// 복합과세금액
|
||||
if($default['de_tax_flag_use']) {
|
||||
if($row['it_notax']) {
|
||||
@ -200,23 +195,7 @@ ob_start();
|
||||
alert('장바구니가 비어 있습니다.', G4_SHOP_URL.'/cart.php');
|
||||
} else {
|
||||
// 배송비 계산
|
||||
if ($default['de_send_cost_case'] == '없음')
|
||||
$send_cost = 0;
|
||||
else if($default['de_send_cost_case'] == '상한') {
|
||||
// 배송비 상한 : 여러단계의 배송비 적용 가능
|
||||
$send_cost_limit = explode(";", $default['de_send_cost_limit']);
|
||||
$send_cost_list = explode(";", $default['de_send_cost_list']);
|
||||
$send_cost = 0;
|
||||
for ($k=0; $k<count($send_cost_limit); $k++) {
|
||||
// 총판매금액이 배송비 상한가 보다 작다면
|
||||
if ($tot_sell_price < preg_replace('/[^0-9]/', '', $send_cost_limit[$k])) {
|
||||
$send_cost = preg_replace('/[^0-9]/', '', $send_cost_list[$k]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$send_cost = $it_send_cost;
|
||||
}
|
||||
$send_cost = get_sendcost($tot_sell_price, $s_cart_id);
|
||||
}
|
||||
|
||||
// 복합과세처리
|
||||
|
||||
@ -182,42 +182,7 @@ if ((int)($row['od_price'] - $tot_cp_price) !== $i_price) {
|
||||
}
|
||||
|
||||
// 배송비가 상이함
|
||||
$tot_sell_price = $row['od_price'];
|
||||
// 배송비 계산
|
||||
if ($default['de_send_cost_case'] == '없음') {
|
||||
$send_cost = 0;
|
||||
} else if($default['de_send_cost_case'] == '상한') {
|
||||
// 배송비 상한 : 여러단계의 배송비 적용 가능
|
||||
$send_cost_limit = explode(";", $default['de_send_cost_limit']);
|
||||
$send_cost_list = explode(";", $default['de_send_cost_list']);
|
||||
$send_cost = 0;
|
||||
for ($k=0; $k<count($send_cost_limit); $k++) {
|
||||
// 총판매금액이 배송비 상한가 보다 작다면
|
||||
if ($tot_sell_price < preg_replace('/[^0-9]/', '', $send_cost_limit[$k])) {
|
||||
$send_cost = preg_replace('/[^0-9]/', '', $send_cost_list[$k]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else { // 개별배송비
|
||||
$send_cost = 0;
|
||||
$sql = " select distinct it_id
|
||||
from {$g4['shop_cart_table']}
|
||||
where od_id = '$tmp_cart_id'
|
||||
and ct_select = '1'
|
||||
and ct_send_cost = '0' ";
|
||||
$result = sql_query($sql);
|
||||
for($i=0; $sc=sql_fetch_array($result); $i++) {
|
||||
// 합계
|
||||
$sql = " select SUM(IF(io_type = 1, (io_price * ct_qty), ((ct_price + io_price) * ct_qty))) as price,
|
||||
SUM(ct_qty) as qty
|
||||
from {$g4['shop_cart_table']}
|
||||
where it_id = '{$sc['it_id']}'
|
||||
and od_id = '$tmp_cart_id' ";
|
||||
$sum = sql_fetch($sql);
|
||||
|
||||
$send_cost += get_item_sendcost($sc['it_id'], $sum['price'], $sum['qty']);
|
||||
}
|
||||
}
|
||||
$send_cost = get_sendcost($row['od_price'], $tmp_cart_id);
|
||||
|
||||
$tot_sc_cp_price = 0;
|
||||
if($is_member && $send_cost > 0) {
|
||||
|
||||
@ -96,11 +96,6 @@ include_once('./_head.php');
|
||||
$it_name .= '<div class="sod_bsk_itopt">'.$it_options.'</div>';
|
||||
}
|
||||
|
||||
// 개별배송비 계산
|
||||
if($default['de_send_cost_case'] == '개별' && !$row['ct_send_cost']) {
|
||||
$it_send_cost += get_item_sendcost($row['it_id'], $sum['price'], $sum['qty']);
|
||||
}
|
||||
|
||||
$point = $sum['point'];
|
||||
$sell_price = $sum['price'];
|
||||
?>
|
||||
@ -131,23 +126,7 @@ include_once('./_head.php');
|
||||
echo '<tr><td colspan="7" class="empty_table">장바구니에 담긴 상품이 없습니다.</td></tr>';
|
||||
} else {
|
||||
// 배송비 계산
|
||||
if ($default['de_send_cost_case'] == '없음')
|
||||
$send_cost = 0;
|
||||
else if($default['de_send_cost_case'] == '상한') {
|
||||
// 배송비 상한 : 여러단계의 배송비 적용 가능
|
||||
$send_cost_limit = explode(";", $default['de_send_cost_limit']);
|
||||
$send_cost_list = explode(";", $default['de_send_cost_list']);
|
||||
$send_cost = 0;
|
||||
for ($k=0; $k<count($send_cost_limit); $k++) {
|
||||
// 총판매금액이 배송비 상한가 보다 작다면
|
||||
if ($tot_sell_price < preg_replace('/[^0-9]/', '', $send_cost_limit[$k])) {
|
||||
$send_cost = preg_replace('/[^0-9]/', '', $send_cost_list[$k]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else { // 개별배송
|
||||
$send_cost = $it_send_cost;
|
||||
}
|
||||
$send_cost = get_sendcost($tot_sell_price, $s_cart_id, 0);
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
|
||||
@ -218,11 +218,6 @@ function get_intall_file()
|
||||
$it_name .= '<div class="sod_bsk_itopt">'.$it_options.'</div>';
|
||||
}
|
||||
|
||||
// 개별배송비 계산
|
||||
if($default['de_send_cost_case'] == '개별' && !$row['ct_send_cost']) {
|
||||
$it_send_cost += get_item_sendcost($row['it_id'], $sum['price'], $sum['qty']);
|
||||
}
|
||||
|
||||
// 복합과세금액
|
||||
if($default['de_tax_flag_use']) {
|
||||
if($row['it_notax']) {
|
||||
@ -288,23 +283,7 @@ function get_intall_file()
|
||||
alert('장바구니가 비어 있습니다.', G4_SHOP_URL.'/cart.php');
|
||||
} else {
|
||||
// 배송비 계산
|
||||
if ($default['de_send_cost_case'] == '없음')
|
||||
$send_cost = 0;
|
||||
else if($default['de_send_cost_case'] == '상한') {
|
||||
// 배송비 상한 : 여러단계의 배송비 적용 가능
|
||||
$send_cost_limit = explode(";", $default['de_send_cost_limit']);
|
||||
$send_cost_list = explode(";", $default['de_send_cost_list']);
|
||||
$send_cost = 0;
|
||||
for ($k=0; $k<count($send_cost_limit); $k++) {
|
||||
// 총판매금액이 배송비 상한가 보다 작다면
|
||||
if ($tot_sell_price < preg_replace('/[^0-9]/', '', $send_cost_limit[$k])) {
|
||||
$send_cost = preg_replace('/[^0-9]/', '', $send_cost_list[$k]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$send_cost = $it_send_cost;
|
||||
}
|
||||
$send_cost = get_sendcost($tot_sell_price, $s_cart_id);
|
||||
}
|
||||
|
||||
// 복합과세처리
|
||||
|
||||
@ -177,42 +177,7 @@ if ((int)($row['od_price'] - $tot_cp_price) !== $i_price) {
|
||||
}
|
||||
|
||||
// 배송비가 상이함
|
||||
$tot_sell_price = $row['od_price'];
|
||||
// 배송비 계산
|
||||
if ($default['de_send_cost_case'] == '없음') {
|
||||
$send_cost = 0;
|
||||
} else if($default['de_send_cost_case'] == '상한') {
|
||||
// 배송비 상한 : 여러단계의 배송비 적용 가능
|
||||
$send_cost_limit = explode(";", $default['de_send_cost_limit']);
|
||||
$send_cost_list = explode(";", $default['de_send_cost_list']);
|
||||
$send_cost = 0;
|
||||
for ($k=0; $k<count($send_cost_limit); $k++) {
|
||||
// 총판매금액이 배송비 상한가 보다 작다면
|
||||
if ($tot_sell_price < preg_replace('/[^0-9]/', '', $send_cost_limit[$k])) {
|
||||
$send_cost = preg_replace('/[^0-9]/', '', $send_cost_list[$k]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else { // 개별배송비
|
||||
$send_cost = 0;
|
||||
$sql = " select distinct it_id
|
||||
from {$g4['shop_cart_table']}
|
||||
where od_id = '$tmp_cart_id'
|
||||
and ct_select = '1'
|
||||
and ct_send_cost = '0' ";
|
||||
$result = sql_query($sql);
|
||||
for($i=0; $sc=sql_fetch_array($result); $i++) {
|
||||
// 합계
|
||||
$sql = " select SUM(IF(io_type = 1, (io_price * ct_qty), ((ct_price + io_price) * ct_qty))) as price,
|
||||
SUM(ct_qty) as qty
|
||||
from {$g4['shop_cart_table']}
|
||||
where it_id = '{$sc['it_id']}'
|
||||
and od_id = '$tmp_cart_id' ";
|
||||
$sum = sql_fetch($sql);
|
||||
|
||||
$send_cost += get_item_sendcost($sc['it_id'], $sum['price'], $sum['qty']);
|
||||
}
|
||||
}
|
||||
$send_cost = get_sendcost($row['od_price'], $tmp_cart_id);
|
||||
|
||||
$tot_sc_cp_price = 0;
|
||||
if($is_member && $send_cost > 0) {
|
||||
|
||||
Reference in New Issue
Block a user