cart 테이블의 ct_num 제거

This commit is contained in:
chicpro
2013-08-27 10:46:26 +09:00
parent 067f2dacb0
commit 476119f53a
19 changed files with 44 additions and 66 deletions

View File

@ -96,7 +96,7 @@ $sql = " select it_id,
ct_notax
from {$g4['shop_cart_table']}
where od_id = '{$od['od_id']}'
and ct_num = '0'
group by it_id
order by ct_id ";
$result = sql_query($sql);
@ -173,7 +173,7 @@ $pg_anchor .='<li><a href="#anc_sodr_chk">결제상세정보 확인</a></li>
from {$g4['shop_cart_table']}
where od_id = '{$od['od_id']}'
and it_id = '{$row['it_id']}'
order by ct_num ";
order by io_type asc, ct_id asc ";
$res = sql_query($sql);
for($k=0; $opt=sql_fetch_array($res); $k++) {

View File

@ -199,8 +199,8 @@ if ($search) // 검색렬일 때만 처음 버튼을 보여줌
$sql2 = " select it_id, it_name
from {$g4['shop_cart_table']}
where od_id = '{$row['od_id']}'
and ct_num = '0'
order by ct_num ";
group by it_id
order by ct_id asc ";
$result2 = sql_query($sql2);
for ($k=0;$row2=sql_fetch_array($result2);$k++) { // for 자식 시작
@ -231,7 +231,7 @@ if ($search) // 검색렬일 때만 처음 버튼을 보여줌
from {$g4['shop_cart_table']}
where od_id = '{$row['od_id']}'
and it_id = '{$row2['it_id']}'
order by ct_num ";
order by io_type asc, ct_id asc ";
$result3 = sql_query($sql3);
for($j=0;$row3=sql_fetch_array($result3);$j++) { // for 손자 시작

View File

@ -48,7 +48,7 @@ if ($csv == 'csv')
$sql .= " and a.od_id between '$fr_od_id' and '$to_od_id' ";
if ($ct_status)
$sql .= " and b.ct_status = '$ct_status' ";
$sql .=" order by od_time asc ";
$sql .=" order by od_time asc, b.it_id, b.io_type, b.ct_id ";
$result = sql_query($sql);
$cnt = @mysql_num_rows($result);
if (!$cnt)
@ -106,7 +106,7 @@ if ($csv == 'xls')
$sql .= " and a.od_id between '$fr_od_id' and '$to_od_id' ";
if ($ct_status)
$sql .= " and b.ct_status = '$ct_status' ";
$sql .=" order by od_time asc ";
$sql .=" order by od_time asc, b.it_id, b.io_type, b.ct_id ";
$result = sql_query($sql);
$cnt = @mysql_num_rows($result);
if (!$cnt)
@ -278,7 +278,7 @@ if (mysql_num_rows($result) == 0)
where od_id = '{$row['od_id']}' ";
if ($ct_status)
$sql2 .= " and ct_status = '$ct_status' ";
$sql2 .= " order by ct_id ";
$sql2 .= " order by it_id, io_type, ct_id ";
$res2 = sql_query($sql2);
$cnt = $sub_tot_qty = $sub_tot_amount = 0;

View File

@ -72,20 +72,11 @@ $result = sql_query($sql, false);
if(!$result) {
sql_query(" ALTER TABLE `{$g4['shop_cart_table']}`
ADD `ct_option` VARCHAR(255) NOT NULL DEFAULT '' AFTER `ct_stock_use`,
ADD `ct_num` INT(11) NOT NULL DEFAULT '0' AFTER `ct_qty`,
ADD `io_id` VARCHAR(255) NOT NULL DEFAULT '' AFTER `ct_qty`,
ADD `io_type` TINYINT(4) NOT NULL DEFAULT '0' AFTER `io_id`,
ADD `io_price` INT(11) NOT NULL DEFAULT '0' AFTER `io_type` ", false);
}
// ct_num 추가
$sql = " select ct_num from {$g4['shop_cart_table']} limit 1 ";
$result = sql_query($sql, false);
if(!$result) {
sql_query(" ALTER TABLE `{$g4['shop_cart_table']}`
ADD `ct_num` INT(11) NOT NULL DEFAULT '0' AFTER `ct_qty` ", false);
}
// it_brand 추가
$sql = " select it_brand from {$g4['shop_item_table']} limit 1 ";
$result = sql_query($sql, false);
@ -380,7 +371,7 @@ $sql = " select ct_notax from {$g4['shop_cart_table']} limit 1 ";
$result = sql_query($sql, false);
if(!$result) {
sql_query(" ALTER TABLE `{$g4['shop_cart_table']}`
ADD `ct_notax` TINYINT(4) NOT NULL DEFAULT '0' AFTER `ct_num` ", true);
ADD `ct_notax` TINYINT(4) NOT NULL DEFAULT '0' AFTER `ct_qty` ", true);
}
*/

View File

@ -67,7 +67,6 @@ CREATE TABLE IF NOT EXISTS `shop_cart` (
`ct_stock_use` tinyint(4) NOT NULL DEFAULT '0',
`ct_option` varchar(255) NOT NULL DEFAULT '',
`ct_qty` int(11) NOT NULL DEFAULT '0',
`ct_num` int(11) NOT NULL DEFAULT '0',
`ct_notax` tinyint(4) NOT NULL DEFAULT '0',
`io_id` varchar(255) NOT NULL DEFAULT '',
`io_type` tinyint(4) NOT NULL DEFAULT '0',
@ -78,8 +77,7 @@ CREATE TABLE IF NOT EXISTS `shop_cart` (
`ct_direct` tinyint(4) NOT NULL DEFAULT '0',
`ct_select` tinyint(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`ct_id`),
KEY `od_id` (`od_id`),
KEY `ct_num` (`ct_num`)
KEY `od_id` (`od_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------

View File

@ -1063,7 +1063,7 @@ function print_item_options($it_id, $cart_id)
{
global $g4;
$sql = " select ct_option, ct_qty from {$g4['shop_cart_table']} where it_id = '$it_id' and od_id = '$cart_id' order by io_type asc, ct_num asc, ct_id asc ";
$sql = " select ct_option, ct_qty from {$g4['shop_cart_table']} where it_id = '$it_id' and od_id = '$cart_id' order by io_type asc, ct_id asc ";
$result = sql_query($sql);
$str = '';

View File

@ -38,12 +38,12 @@ include_once(G4_MSHOP_PATH.'/_head.php');
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.od_id = '$s_cart_id'
and a.ct_num = '0' ";
where a.od_id = '$s_cart_id' ";
if($default['de_cart_keep_term']) {
$ctime = date('Y-m-d H:i:s', G4_SERVER_TIME - ($default['de_cart_keep_term'] * 86400));
$sql .= " and a.ct_time > '$ctime' ";
}
$sql .= " group by a.it_id ";
$sql .= " order by a.ct_id ";
$result = sql_query($sql);

View File

@ -72,12 +72,12 @@ ob_start();
b.it_notax
from {$g4['shop_cart_table']} a left join {$g4['shop_item_table']} b on ( a.it_id = b.it_id )
where a.od_id = '$s_cart_id'
and a.ct_select = '1'
and a.ct_num = '0' ";
and a.ct_select = '1' ";
if($default['de_cart_keep_term']) {
$ctime = date('Y-m-d H:i:s', G4_SERVER_TIME - ($default['de_cart_keep_term'] * 86400));
$sql .= " and a.ct_time > '$ctime' ";
}
$sql .= " group by a.it_id ";
$sql .= " order by a.ct_id ";
$result = sql_query($sql);

View File

@ -201,11 +201,10 @@ if ($default['de_send_cost_case'] == '없음') {
}
} else { // 개별배송비
$send_cost = 0;
$sql = " select it_id
$sql = " select distinct it_id
from {$g4['shop_cart_table']}
where od_id = '$tmp_cart_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++) {
@ -520,7 +519,8 @@ if($is_member) {
where od_id = '$od_id'
and it_id = '$cp_it_id'
and ct_select = '1'
and ct_num = '0' ";
order by ct_id asc
limit 1 ";
sql_query($sql);
}

View File

@ -57,7 +57,7 @@ include_once(G4_MSHOP_PATH.'/_head.php');
$sql = " select it_id, it_name, cp_amount
from {$g4['shop_cart_table']}
where od_id = '$od_id'
and ct_num = '0'
group by it_id
order by ct_id ";
$result = sql_query($sql);
?>
@ -89,7 +89,7 @@ include_once(G4_MSHOP_PATH.'/_head.php');
from {$g4['shop_cart_table']}
where od_id = '$od_id'
and it_id = '{$row['it_id']}'
order by ct_num ";
order by it_type asc, ct_id asc ";
$res = sql_query($sql);
$ct_list = array();

View File

@ -8,8 +8,8 @@ if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
<ul>
<?php
$hsql = " select a.it_id, a.it_name, a.ct_qty from {$g4['shop_cart_table']} a left join {$g4['shop_item_table']} b on ( a.it_id = b.it_id ) ";
$hsql .= " where a.od_id = '".get_session('ss_cart_id')."' and a.ct_num = '0' order by a.ct_id ";
$hsql = " select it_id, it_name from {$g4['shop_cart_table']} ";
$hsql .= " where od_id = '".get_session('ss_cart_id')."' group by it_id ";
$hresult = sql_query($hsql);
for ($i=0; $row=sql_fetch_array($hresult); $i++)
{

View File

@ -60,12 +60,12 @@ include_once('./_head.php');
b.ca_id2,
b.ca_id3
from {$g4['shop_cart_table']} a left join {$g4['shop_item_table']} b on ( a.it_id = b.it_id )
where a.od_id = '$s_cart_id'
and a.ct_num = '0' ";
where a.od_id = '$s_cart_id' ";
if($default['de_cart_keep_term']) {
$ctime = date('Y-m-d H:i:s', G4_SERVER_TIME - ($default['de_cart_keep_term'] * 86400));
$sql .= " and a.ct_time > '$ctime' ";
}
$sql .= " group by a.it_id ";
$sql .= " order by a.ct_id ";
$result = sql_query($sql);

View File

@ -12,11 +12,11 @@ if(!$it['it_id'])
// 장바구니 자료
$cart_id = get_session('ss_cart_id');
$sql = " select * from {$g4['shop_cart_table']} where od_id = '$cart_id' and it_id = '$it_id' order by io_type asc, ct_num asc, ct_id asc ";
$sql = " select * from {$g4['shop_cart_table']} where od_id = '$cart_id' and it_id = '$it_id' order by io_type asc, ct_id asc ";
$result = sql_query($sql);
// 판매가격
$sql2 = " select ct_price, it_name, ct_send_cost from {$g4['shop_cart_table']} where od_id = '$cart_id' and it_id = '$it_id' and ct_num = '0' ";
$sql2 = " select ct_price, it_name, ct_send_cost from {$g4['shop_cart_table']} where od_id = '$cart_id' and it_id = '$it_id' order by ct_id asc limit 1 ";
$row2 = sql_fetch($sql2);
if(!mysql_num_rows($result))

View File

@ -160,20 +160,9 @@ else // 장바구니에 담기
$ct_select = 0;
// 장바구니에 Insert
$sql = " select ct_num
from {$g4['shop_cart_table']}
where it_id = '$it_id'
and od_id = '$tmp_cart_id'
order by ct_num desc ";
$row = sql_fetch($sql);
if($row['ct_num'] != '')
$ct_num = (int)$row['ct_num'] + 1;
else
$ct_num = 0;
$comma = '';
$sql = " INSERT INTO {$g4['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_num, 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, 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++) {
@ -208,9 +197,8 @@ else // 장바구니에 담기
continue;
}
$sql .= $comma."( '$tmp_cart_id', '{$member['mb_id']}', '{$it['it_id']}', '{$it['it_name']}', '쇼핑', '{$it['it_price']}', '$point', '0', '0', '$io_value', '$ct_qty', '$ct_num', '{$it['it_notax']}', '$io_id', '$io_type', '$io_price', '".G4_TIME_YMDHIS."', '$REMOTE_ADDR', '$ct_send_cost', '$sw_direct', '$ct_select' )";
$sql .= $comma."( '$tmp_cart_id', '{$member['mb_id']}', '{$it['it_id']}', '{$it['it_name']}', '쇼핑', '{$it['it_price']}', '$point', '0', '0', '$io_value', '$ct_qty', '{$it['it_notax']}', '$io_id', '$io_type', '$io_price', '".G4_TIME_YMDHIS."', '$REMOTE_ADDR', '$ct_send_cost', '$sw_direct', '$ct_select' )";
$comma = ' , ';
$ct_num++;
$ct_count++;
}

View File

@ -162,12 +162,12 @@ function get_intall_file()
b.it_notax
from {$g4['shop_cart_table']} a left join {$g4['shop_item_table']} b on ( a.it_id = b.it_id )
where a.od_id = '$s_cart_id'
and a.ct_select = '1'
and a.ct_num = '0' ";
and a.ct_select = '1' ";
if($default['de_cart_keep_term']) {
$ctime = date('Y-m-d H:i:s', G4_SERVER_TIME - ($default['de_cart_keep_term'] * 86400));
$sql .= " and a.ct_time > '$ctime' ";
}
$sql .= " group by a.it_id ";
$sql .= " order by a.ct_id ";
$result = sql_query($sql);

View File

@ -195,11 +195,10 @@ if ($default['de_send_cost_case'] == '없음') {
}
} else { // 개별배송비
$send_cost = 0;
$sql = " select it_id
$sql = " select distinct it_id
from {$g4['shop_cart_table']}
where od_id = '$tmp_cart_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++) {
@ -514,7 +513,8 @@ if($is_member) {
where od_id = '$od_id'
and it_id = '$cp_it_id'
and ct_select = '1'
and ct_num = '0' ";
order by ct_id asc
limit 1 ";
sql_query($sql);
}

View File

@ -67,10 +67,10 @@ if(openwin != null) {
$od_count1 = $od_count2 = 0;
$idx = 0;
$sql = " select it_id, it_name, cp_amount
$sql = " select it_id, it_name
from {$g4['shop_cart_table']}
where od_id = '$od_id'
and ct_num = '0'
group by it_id
order by ct_id ";
$result = sql_query($sql);
?>
@ -98,11 +98,11 @@ if(openwin != null) {
</thead>
<tbody>
<?php
$sql = " select ct_id, it_name, ct_option, ct_qty, ct_price, ct_point, ct_status, io_type, io_price
$sql = " select ct_id, it_name, ct_option, ct_qty, ct_price, ct_point, ct_status, cp_amount, io_type, io_price
from {$g4['shop_cart_table']}
where od_id = '$od_id'
and it_id = '{$row['it_id']}'
order by ct_num ";
order by io_type asc, ct_id asc ";
$res = sql_query($sql);
$ct_list = array();
@ -150,13 +150,13 @@ if(openwin != null) {
$od_count2++;
$idx++;
$tot_cp_amount += $opt['cp_amount'];
}
?>
</tbody>
</table>
</li>
<?php
$tot_cp_amount += $row['cp_amount'];
}
$send_cost = $od['od_send_cost'];

View File

@ -20,7 +20,8 @@ $sql = " select a.it_id,
from {$g4['shop_cart_table']} a left join {$g4['shop_item_table']} b on ( a.it_id = b.it_id )
where a.od_id = '$od_id'
and a.ct_select = '1'
and a.ct_num = '0' ";
group by a.it_id
order by a.ct_id asc ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
@ -38,7 +39,7 @@ for ($i=0; $row=sql_fetch_array($result); $i++)
$sql2 = " select ct_option, ct_qty
from {$g4['shop_cart_table']}
where it_id = '{$row['it_id']}' and od_id = '$od_id' and ct_select = '1'
order by io_type asc, ct_num asc, ct_id asc ";
order by io_type asc, ct_id asc ";
$result2 = sql_query($sql2);
$options = '';

View File

@ -41,8 +41,8 @@ $sql = " select b.it_sell_email,
from {$g4['shop_cart_table']} a left join {$g4['shop_item_table']} b on ( a.it_id = b.it_id )
where a.od_id = '$od_id'
and a.ct_select = '1'
and a.ct_num = '0'
and b.it_sell_email <> '' ";
and b.it_sell_email <> ''
group by a.it_id ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
@ -60,7 +60,7 @@ for ($i=0; $row=sql_fetch_array($result); $i++)
$sql2 = " select ct_option, ct_qty
from {$g4['shop_cart_table']}
where it_id = '{$row['it_id']}' and od_id = '$od_id' and ct_select = '1'
order by io_type asc, ct_num asc, ct_id asc ";
order by io_type asc, ct_id asc ";
$result2 = sql_query($sql2);
$options = '';