#210 cart 테이블에 배송비 지불방법만 기록하도록 수정

This commit is contained in:
chicpro
2013-06-13 13:48:35 +09:00
parent 1347cb9654
commit 79adb5d9b4
11 changed files with 71 additions and 49 deletions

View File

@ -296,12 +296,10 @@ if(!$result) {
}
// 장바구니 배송비필드 추가
$sql = " select ct_send_cost2 from {$g4['shop_cart_table']} limit 1 ";
$sql = " select ct_send_cost from {$g4['shop_cart_table']} limit 1 ";
$result = sql_query($sql, false);
if(!$result) {
sql_query(" ALTER TABLE `{$g4['shop_cart_table']}`
DROP `ct_send_cost`,
ADD `ct_send_cost` INT(11) NOT NULL DEFAULT '0' AFTER `io_price`,
ADD `ct_send_cost2` TINYINT(4) NOT NULL DEFAULT '0' AFTER `ct_send_cost` ", false);
ADD `ct_send_cost` TINYINT(11) NOT NULL DEFAULT '0' AFTER `io_price` ", false);
}
?>

View File

@ -74,8 +74,7 @@ CREATE TABLE IF NOT EXISTS `shop_cart` (
`io_price` int(11) NOT NULL DEFAULT '0',
`ct_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`ct_ip` varchar(25) NOT NULL DEFAULT '',
`ct_send_cost` int(11) NOT NULL DEFAULT '0',
`ct_send_cost2` tinyint(4) NOT NULL DEFAULT '0',
`ct_send_cost` tinyint(4) NOT NULL DEFAULT '0',
`ct_direct` tinyint(4) NOT NULL DEFAULT '0',
`ct_select` tinyint(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`ct_id`),

View File

@ -35,6 +35,7 @@ include_once(G4_MSHOP_PATH.'/_head.php');
a.ct_point,
a.ct_qty,
a.ct_status,
a.ct_send_cost,
b.ca_id
from {$g4['shop_cart_table']} a left join {$g4['shop_item_table']} b on ( a.it_id = b.it_id )
where a.uq_id = '$s_uq_id'
@ -75,7 +76,7 @@ include_once(G4_MSHOP_PATH.'/_head.php');
}
// 개별배송비 계산
if($default['de_send_cost_case'] == '개별') {
if($default['de_send_cost_case'] == '개별' && !$row['ct_send_cost']) {
$it_send_cost += get_item_sendcost($row['it_id'], $sum['price'], $sum['qty']);
}

View File

@ -343,24 +343,16 @@ else
<?php } ?>
<?php if($default['de_send_cost_case'] == '개별' && $it['it_sc_type'] != 0) { ?>
<tr>
<th><label for="ct_send_cost2">배송비결제</label></th>
<th><label for="ct_send_cost">배송비결제</label></th>
<td>
<?php
if($it['it_sc_method'] == 2) {
?>
<select name="ct_send_cost2" id="ct_send_cost2">
<select name="ct_send_cost" id="ct_send_cost">
<option value="0">주문시 결제</option>
<option value="1">수령후 지불</option>
</select>
<?php
} else {
if($it['it_sc_method']) {
echo '<input type="hidden" name="ct_send_cost2" value="1">';
echo '수령후 지불';
} else {
echo '<input type="hidden" name="ct_send_cost2" value="0">';
echo '주문시 결제';
}
}
?>
</td>
@ -578,10 +570,12 @@ else
<h2>사용후기</h2>
<?php echo pg_anchor_m('use'); ?>
<?php
$use_page_rows = 10; // 페이지당 목록수
include_once(G4_MSHOP_PATH.'/itemuse.inc.php');
?>
<div id="itemuse"></div>
<script>
$(function(){
$("#itemuse").load("./itemuse.php", {it_id:"<?php echo $it_id; ?>"});
});
</script>
</section>
<section id="sit_qa">

View File

@ -65,6 +65,7 @@ ob_start();
a.ct_point,
a.ct_qty,
a.ct_status,
a.ct_send_cost,
b.ca_id
from {$g4['shop_cart_table']} a left join {$g4['shop_item_table']} b on ( a.it_id = b.it_id )
where a.uq_id = '$s_uq_id'
@ -78,6 +79,7 @@ ob_start();
$result = sql_query($sql);
$good_info = '';
$it_send_cost = 0;
for ($i=0; $row=mysql_fetch_array($result); $i++)
{
@ -120,6 +122,11 @@ 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']);
}
$point = $sum['point'];
$sell_amount = $sum['price'];
@ -175,18 +182,20 @@ ob_start();
// 배송비 계산
if ($default['de_send_cost_case'] == '없음')
$send_cost = 0;
else {
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_amount < $send_cost_limit[$k]) {
$send_cost = $send_cost_list[$k];
if ($tot_sell_amount < 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;
}
}
?>

View File

@ -72,6 +72,7 @@ include_once('./_head.php');
a.ct_point,
a.ct_qty,
a.ct_status,
a.ct_send_cost,
b.ca_id,
b.ca_id2,
b.ca_id3
@ -114,7 +115,7 @@ include_once('./_head.php');
}
// 개별배송비 계산
if($default['de_send_cost_case'] == '개별') {
if($default['de_send_cost_case'] == '개별' && !$row['ct_send_cost']) {
$it_send_cost += get_item_sendcost($row['it_id'], $sum['price'], $sum['qty']);
}

View File

@ -19,7 +19,7 @@ $sql = " select * from {$g4['shop_cart_table']} where uq_id = '$uq_id' and it_id
$result = sql_query($sql);
// 판매가격
$sql2 = " select ct_price, it_name, ct_send_cost, ct_send_cost2
$sql2 = " select ct_price, it_name, ct_send_cost
from {$g4['shop_cart_table']} where uq_id = '$uq_id' and it_id = '$it_id' and ct_num = '0' ";
$row2 = sql_fetch($sql2);
@ -34,7 +34,6 @@ if(!mysql_num_rows($result))
<input type="hidden" name="it_name" value="<?php echo $row2['it_name']; ?>">
<input type="hidden" name="it_point" value="<?php echo $it_point; ?>">
<input type="hidden" name="ct_send_cost" value="<?php echo $row2['ct_send_cost']; ?>">
<input type="hidden" name="ct_send_cost2" value="<?php echo $row2['ct_send_cost2']; ?>">
<input type="hidden" name="total_price" value="">
<input type="hidden" name="sw_direct">
<?php

View File

@ -231,11 +231,11 @@ else if ($act == "optionmod") // 장바구니에서 옵션변경
// 장바구니에 Insert
$comma = '';
$sql = " INSERT INTO {$g4['shop_cart_table']}
( uq_id, it_id, it_name, ct_status, ct_price, ct_point, ct_point_use, ct_stock_use, ct_option, ct_qty, ct_num, io_id, io_type, io_price, ct_time, ct_ip, ct_direct, ct_send_cost, ct_send_cost2 )
( uq_id, it_id, it_name, ct_status, ct_price, ct_point, ct_point_use, ct_stock_use, ct_option, ct_qty, ct_num, io_id, io_type, io_price, ct_time, ct_ip, ct_direct, ct_send_cost )
VALUES ";
for($i=0; $i<$option_count; $i++) {
$sql .= $comma."( '$tmp_uq_id', '{$_POST['it_id']}', '{$_POST['it_name']}', '쇼핑', '{$_POST['it_price']}', '{$_POST['it_point']}', '0', '0', '{$_POST['io_value'][$i]}', '{$_POST['ct_qty'][$i]}', '$i', '{$_POST['io_id'][$i]}', '{$_POST['io_type'][$i]}', '{$_POST['io_price'][$i]}', '".G4_TIME_YMDHIS."', '$REMOTE_ADDR', '$sw_direct', '$ct_send_cost', '$ct_send_cost2' )";
$sql .= $comma."( '$tmp_uq_id', '{$_POST['it_id']}', '{$_POST['it_name']}', '쇼핑', '{$_POST['it_price']}', '{$_POST['it_point']}', '0', '0', '{$_POST['io_value'][$i]}', '{$_POST['ct_qty'][$i]}', '$i', '{$_POST['io_id'][$i]}', '{$_POST['io_type'][$i]}', '{$_POST['io_price'][$i]}', '".G4_TIME_YMDHIS."', '$REMOTE_ADDR', '$sw_direct', '$ct_send_cost' )";
$comma = ' , ';
}
@ -359,7 +359,7 @@ else // 장바구니에 담기
$ct_count = 0;
$comma = '';
$sql = " INSERT INTO {$g4['shop_cart_table']}
( uq_id, mb_id, it_id, it_name, ct_status, ct_price, ct_point, ct_point_use, ct_stock_use, ct_option, ct_qty, ct_num, io_id, io_type, io_price, ct_time, ct_ip, ct_send_cost, ct_send_cost2, ct_direct, ct_select )
( uq_id, mb_id, it_id, it_name, ct_status, ct_price, ct_point, ct_point_use, ct_stock_use, ct_option, ct_qty, ct_num, io_id, io_type, io_price, ct_time, ct_ip, ct_send_cost, ct_direct, ct_select )
VALUES ";
for($i=0; $i<$option_count; $i++) {
@ -380,7 +380,7 @@ else // 장바구니에 담기
continue;
}
$sql .= $comma."( '$tmp_uq_id', '{$member['mb_id']}', '{$_POST['it_id']}', '{$_POST['it_name']}', '쇼핑', '{$_POST['it_price']}', '{$_POST['it_point']}', '0', '0', '{$_POST['io_value'][$i]}', '{$_POST['ct_qty'][$i]}', '$ct_num', '{$_POST['io_id'][$i]}', '{$_POST['io_type'][$i]}', '{$_POST['io_price'][$i]}', '".G4_TIME_YMDHIS."', '$REMOTE_ADDR', '$it_send_cost', '$ct_send_cost2', '$sw_direct', '$ct_select' )";
$sql .= $comma."( '$tmp_uq_id', '{$member['mb_id']}', '{$_POST['it_id']}', '{$_POST['it_name']}', '쇼핑', '{$_POST['it_price']}', '{$_POST['it_point']}', '0', '0', '{$_POST['io_value'][$i]}', '{$_POST['ct_qty'][$i]}', '$ct_num', '{$_POST['io_id'][$i]}', '{$_POST['io_type'][$i]}', '{$_POST['io_price'][$i]}', '".G4_TIME_YMDHIS."', '$REMOTE_ADDR', '$ct_send_cost', '$sw_direct', '$ct_select' )";
$comma = ' , ';
$ct_num++;
$ct_count++;

View File

@ -347,24 +347,16 @@ else
<?php } ?>
<?php if($default['de_send_cost_case'] == '개별' && $it['it_sc_type'] != 0) { ?>
<tr>
<th><label for="ct_send_cost2">배송비결제</label></th>
<th><label for="ct_send_cost">배송비결제</label></th>
<td>
<?php
if($it['it_sc_method'] == 2) {
?>
<select name="ct_send_cost2" id="ct_send_cost2">
<select name="ct_send_cost" id="ct_send_cost">
<option value="0">주문시 결제</option>
<option value="1">수령후 지불</option>
</select>
<?php
} else {
if($it['it_sc_method']) {
echo '<input type="hidden" name="ct_send_cost2" value="1">';
echo '수령후 지불';
} else {
echo '<input type="hidden" name="ct_send_cost2" value="0">';
echo '주문시 결제';
}
}
?>
</td>
@ -585,7 +577,7 @@ else
<div id="itemuse"></div>
<script>
$(function(){
$("#itemuse").load("./itemuse.php", {it_id:<?php echo $it_id; ?>});
$("#itemuse").load("./itemuse.php", {it_id:"<?php echo $it_id; ?>"});
});
</script>
</section>

View File

@ -140,6 +140,7 @@ setTimeout("init_pay_button();",300);
a.ct_point,
a.ct_qty,
a.ct_status,
a.ct_send_cost,
b.ca_id,
b.ca_id2,
b.ca_id3
@ -155,6 +156,7 @@ setTimeout("init_pay_button();",300);
$result = sql_query($sql);
$good_info = '';
$it_send_cost = 0;
for ($i=0; $row=mysql_fetch_array($result); $i++)
{
@ -195,6 +197,11 @@ setTimeout("init_pay_button();",300);
$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_amount = $sum['price'];
@ -250,18 +257,20 @@ setTimeout("init_pay_button();",300);
// 배송비 계산
if ($default['de_send_cost_case'] == '없음')
$send_cost = 0;
else {
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_amount < $send_cost_limit[$k]) {
$send_cost = $send_cost_list[$k];
if ($tot_sell_amount < 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;
}
}
?>

View File

@ -172,20 +172,40 @@ if ((int)($row['od_amount'] - $tot_cp_amount) !== $i_amount) {
// 배송비가 상이함
$tot_sell_amount = $row['od_amount'];
// 배송비 계산
if ($default['de_send_cost_case'] == "없음") {
if ($default['de_send_cost_case'] == '없음') {
$send_cost = 0;
} else {
} 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_amount < $send_cost_limit[$k]) {
$send_cost = $send_cost_list[$k];
if ($tot_sell_amount < 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 it_id
from {$g4['shop_cart_table']}
where uq_id = '$tmp_uq_id'
and ct_select = '1'
and ct_num = '0'
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 uq_id = '$tmp_uq_id' ";
$sum = sql_fetch($sql);
$send_cost += get_item_sendcost($sc['it_id'], $sum['price'], $sum['qty']);
}
}
$tot_sc_cp_amount = 0;