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

@ -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 = '';