diff --git a/adm/shop_admin/orderform.php b/adm/shop_admin/orderform.php
index f511f5621..d42f654e2 100644
--- a/adm/shop_admin/orderform.php
+++ b/adm/shop_admin/orderform.php
@@ -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 .='
결제상세정보 확인
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++) {
diff --git a/adm/shop_admin/orderlist2.php b/adm/shop_admin/orderlist2.php
index 693cc1b09..020f44e03 100644
--- a/adm/shop_admin/orderlist2.php
+++ b/adm/shop_admin/orderlist2.php
@@ -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 손자 시작
diff --git a/adm/shop_admin/orderprintresult.php b/adm/shop_admin/orderprintresult.php
index 85f10695f..ac1aadddc 100644
--- a/adm/shop_admin/orderprintresult.php
+++ b/adm/shop_admin/orderprintresult.php
@@ -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;
diff --git a/extend/shop.extend2.php b/extend/shop.extend2.php
index 8b1527494..f1f400393 100644
--- a/extend/shop.extend2.php
+++ b/extend/shop.extend2.php
@@ -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);
}
*/
diff --git a/install/shop.sql b/install/shop.sql
index 5e6577fc0..b08a8aaeb 100644
--- a/install/shop.sql
+++ b/install/shop.sql
@@ -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;
-- --------------------------------------------------------
diff --git a/lib/shop.lib.php b/lib/shop.lib.php
index 5dcc6d86e..2bce24630 100644
--- a/lib/shop.lib.php
+++ b/lib/shop.lib.php
@@ -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 = '';
diff --git a/mobile/shop/cart.php b/mobile/shop/cart.php
index 8fba8a88d..51e48be44 100644
--- a/mobile/shop/cart.php
+++ b/mobile/shop/cart.php
@@ -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);
diff --git a/mobile/shop/orderform.php b/mobile/shop/orderform.php
index abb27284f..c7f706091 100644
--- a/mobile/shop/orderform.php
+++ b/mobile/shop/orderform.php
@@ -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);
diff --git a/mobile/shop/orderformupdate.php b/mobile/shop/orderformupdate.php
index fe3d922c9..c290b3333 100644
--- a/mobile/shop/orderformupdate.php
+++ b/mobile/shop/orderformupdate.php
@@ -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);
}
diff --git a/mobile/shop/orderinquiryview.php b/mobile/shop/orderinquiryview.php
index 59ec5c0e7..10056bb6f 100644
--- a/mobile/shop/orderinquiryview.php
+++ b/mobile/shop/orderinquiryview.php
@@ -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();
diff --git a/shop/boxcart.inc.php b/shop/boxcart.inc.php
index 9ed5ddc8b..0697283f0 100644
--- a/shop/boxcart.inc.php
+++ b/shop/boxcart.inc.php
@@ -8,8 +8,8 @@ if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
'$ctime' ";
}
+ $sql .= " group by a.it_id ";
$sql .= " order by a.ct_id ";
$result = sql_query($sql);
diff --git a/shop/cartoption.php b/shop/cartoption.php
index 9dd5717dd..ac807fe80 100644
--- a/shop/cartoption.php
+++ b/shop/cartoption.php
@@ -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))
diff --git a/shop/cartupdate.php b/shop/cartupdate.php
index c352c5e21..79a60fa19 100644
--- a/shop/cartupdate.php
+++ b/shop/cartupdate.php
@@ -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++;
}
diff --git a/shop/orderform.php b/shop/orderform.php
index b4a010bd1..2f33f6680 100644
--- a/shop/orderform.php
+++ b/shop/orderform.php
@@ -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);
diff --git a/shop/orderformupdate.php b/shop/orderformupdate.php
index 7a6cba8d6..4f945ab51 100644
--- a/shop/orderformupdate.php
+++ b/shop/orderformupdate.php
@@ -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);
}
diff --git a/shop/orderinquiryview.php b/shop/orderinquiryview.php
index 0735d6c49..da9d92848 100644
--- a/shop/orderinquiryview.php
+++ b/shop/orderinquiryview.php
@@ -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) {
'' ";
+ 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 = '';