상품배송비 관련 오류 수정 - TopSchooL님 제보

This commit is contained in:
chicpro
2014-03-31 13:02:07 +09:00
parent c83266d0f0
commit 3383ffbcd0
6 changed files with 47 additions and 23 deletions

View File

@ -41,7 +41,7 @@ if (!function_exists("itemdelete")) {
@unlink(G5_DATA_PATH."/item/$it_id"."_t");
// 장바구니 삭제
$sql = " delete from {$g5['g5_shop_cart_table']} where it_id = '$it_id' ";
$sql = " delete from {$g5['g5_shop_cart_table']} where it_id = '$it_id' and ct_status = '쇼핑' ";
sql_query($sql);
// 이벤트삭제

View File

@ -77,6 +77,16 @@ if(!sql_query(" select ad_addr3 from {$g5['g5_shop_order_address_table']} limit
sql_query(" ALTER TABLE `{$g5['g5_shop_order_address_table']}`
ADD `ad_addr3` varchar(255) NOT NULL DEFAULT '' AFTER `ad_addr2` ", true);
}
// 배송비정보 필드 cart 테이블에 추가
if(!sql_query(" select it_sc_type from {$g5['g5_shop_cart_table']} limit 1 ", false)) {
sql_query(" ALTER TABLE `{$g5['g5_shop_cart_table']}`
ADD `it_sc_type` tinyint(4) NOT NULL DEFAULT '0' AFTER `it_name`,
ADD `it_sc_method` tinyint(4) NOT NULL DEFAULT '0' AFTER `it_sc_type`,
ADD `it_sc_price` int(11) NOT NULL DEFAULT '0' AFTER `it_sc_method`,
ADD `it_sc_minimum` int(11) NOT NULL DEFAULT '0' AFTER `it_sc_price`,
ADD `it_sc_qty` int(11) NOT NULL DEFAULT '0' AFTER `it_sc_minimum` ", true);
}
?>
<section id="anc_sodr_list">

View File

@ -56,13 +56,17 @@ if($_POST['od_delivery_company'] && $_POST['od_invoice'] && in_array($od['od_sta
$cart_status = true;
}
// 미수금액
$od_misu = ( $od['od_cart_price'] - $od['od_cancel_price'] + $od_send_cost + $od_send_cost2 )
- ( $od['od_cart_coupon'] + $od['od_coupon'] + $od['od_send_coupon'] )
- ( $od['od_receipt_price'] + $od['od_receipt_point'] - $od['od_refund_price'] );
// 미수금 정보 등 반영
$sql = " update {$g5['g5_shop_order_table']}
set od_misu = '{$info['od_misu']}',
set od_misu = '$od_misu',
od_tax_mny = '{$info['od_tax_mny']}',
od_vat_mny = '{$info['od_vat_mny']}',
od_free_mny = '{$info['od_free_mny']}',
od_send_cost = '{$info['od_send_cost']}',
od_status = '$od_status'
where od_id = '$od_id' ";
sql_query($sql);

View File

@ -33,6 +33,11 @@ CREATE TABLE IF NOT EXISTS `g5_shop_cart` (
`mb_id` varchar(255) NOT NULL DEFAULT '',
`it_id` varchar(20) NOT NULL DEFAULT '',
`it_name` varchar(255) NOT NULL DEFAULT '',
`it_sc_type` tinyint(4) NOT NULL DEFAULT '0',
`it_sc_method` tinyint(4) NOT NULL DEFAULT '0',
`it_sc_price` int(11) NOT NULL DEFAULT '0',
`it_sc_minimum` int(11) NOT NULL DEFAULT '0',
`it_sc_qty` int(11) NOT NULL DEFAULT '0',
`ct_status` varchar(255) NOT NULL DEFAULT '',
`ct_history` text NOT NULL,
`ct_price` int(11) NOT NULL DEFAULT '0',

View File

@ -1695,10 +1695,12 @@ function get_sendcost($cart_id, $selected=1)
SUM(ct_qty) as qty
from {$g5['g5_shop_cart_table']}
where it_id = '{$sc['it_id']}'
and od_id = '$cart_id' ";
and od_id = '$cart_id'
and ct_status IN ( '쇼핑', '주문', '입금', '준비', '배송', '완료' )
and ct_select = '$selected'";
$sum = sql_fetch($sql);
$send_cost = get_item_sendcost($sc['it_id'], $sum['price'], $sum['qty']);
$send_cost = get_item_sendcost($sc['it_id'], $sum['price'], $sum['qty'], $cart_id);
if($send_cost > 0)
$total_send_cost += $send_cost;
@ -1727,33 +1729,36 @@ function get_sendcost($cart_id, $selected=1)
// 상품별 배송비
function get_item_sendcost($it_id, $price, $qty)
function get_item_sendcost($it_id, $price, $qty, $cart_id)
{
global $g5, $default;
$sql = " select it_id, it_sc_type, it_sc_method, it_sc_price, it_sc_minimum, it_sc_qty
from {$g5['g5_shop_item_table']}
where it_id = '$it_id' ";
$it = sql_fetch($sql);
if(!$it['it_id'])
from {$g5['g5_shop_cart_table']}
where it_id = '$it_id'
and od_id = '$cart_id'
order by ct_id
limit 1 ";
$ct = sql_fetch($sql);
if(!$ct['it_id'])
return 0;
if($it['it_sc_type'] > 1) {
if($it['it_sc_type'] == 2) { // 조건부무료
if($price >= $it['it_sc_minimum'])
if($ct['it_sc_type'] > 1) {
if($ct['it_sc_type'] == 2) { // 조건부무료
if($price >= $ct['it_sc_minimum'])
$sendcost = 0;
else
$sendcost = $it['it_sc_price'];
} else if($it['it_sc_type'] == 3) { // 유료배송
$sendcost = $it['it_sc_price'];
$sendcost = $ct['it_sc_price'];
} else if($ct['it_sc_type'] == 3) { // 유료배송
$sendcost = $ct['it_sc_price'];
} else { // 수량별 부과
if(!$it['it_sc_qty'])
$it['it_sc_qty'] = 1;
if(!$ct['it_sc_qty'])
$ct['it_sc_qty'] = 1;
$q = ceil((int)$qty / (int)$it['it_sc_qty']);
$sendcost = (int)$it['it_sc_price'] * $q;
$q = ceil((int)$qty / (int)$ct['it_sc_qty']);
$sendcost = (int)$ct['it_sc_price'] * $q;
}
} else if($it['it_sc_type'] == 1) { // 무료배송
} else if($ct['it_sc_type'] == 1) { // 무료배송
$sendcost = 0;
} else {
$sendcost = -1;

View File

@ -191,7 +191,7 @@ else // 장바구니에 담기
// 장바구니에 Insert
$comma = '';
$sql = " INSERT INTO {$g5['g5_shop_cart_table']}
( od_id, mb_id, it_id, it_name, ct_status, ct_price, ct_point, ct_point_use, ct_stock_use, ct_option, ct_qty, ct_notax, io_id, io_type, io_price, ct_time, ct_ip, ct_send_cost, ct_direct, ct_select )
( od_id, mb_id, it_id, it_name, it_sc_type, it_sc_method, it_sc_price, it_sc_minimum, it_sc_qty, ct_status, ct_price, ct_point, ct_point_use, ct_stock_use, ct_option, ct_qty, ct_notax, io_id, io_type, io_price, ct_time, ct_ip, ct_send_cost, ct_direct, ct_select )
VALUES ";
for($k=0; $k<$opt_count; $k++) {
@ -254,7 +254,7 @@ else // 장바구니에 담기
else if($it['it_sc_type'] > 1 && $it['it_sc_method'] == 1)
$ct_send_cost = 1; // 착불
$sql .= $comma."( '$tmp_cart_id', '{$member['mb_id']}', '{$it['it_id']}', '".addslashes($it['it_name'])."', '쇼핑', '{$it['it_price']}', '$point', '0', '0', '$io_value', '$ct_qty', '{$it['it_notax']}', '$io_id', '$io_type', '$io_price', '".G5_TIME_YMDHIS."', '$REMOTE_ADDR', '$ct_send_cost', '$sw_direct', '$ct_select' )";
$sql .= $comma."( '$tmp_cart_id', '{$member['mb_id']}', '{$it['it_id']}', '".addslashes($it['it_name'])."', '{$it['it_sc_type']}', '{$it['it_sc_method']}', '{$it['it_sc_price']}', '{$it['it_sc_minimum']}', '{$it['it_sc_qty']}', '쇼핑', '{$it['it_price']}', '$point', '0', '0', '$io_value', '$ct_qty', '{$it['it_notax']}', '$io_id', '$io_type', '$io_price', '".G5_TIME_YMDHIS."', '$REMOTE_ADDR', '$ct_send_cost', '$sw_direct', '$ct_select' )";
$comma = ' , ';
$ct_count++;
}