From 054eb67bc5dfc40360a9fedf6a914fb4fdd992cc Mon Sep 17 00:00:00 2001 From: chicpro Date: Tue, 28 May 2013 14:52:13 +0900 Subject: [PATCH] =?UTF-8?q?=EB=8F=99=EC=9D=BC=20=EC=98=B5=EC=85=98=20?= =?UTF-8?q?=EC=83=81=ED=92=88=EC=9D=84=20=EC=B6=94=EA=B0=80=EB=A1=9C=20?= =?UTF-8?q?=EB=8B=B4=EC=9D=84=20=EA=B2=BD=EC=9A=B0=20=EC=88=98=EB=9F=89?= =?UTF-8?q?=EC=9D=B4=20=EB=8D=94=ED=95=B4=EC=A7=80=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shop/cartupdate.php | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/shop/cartupdate.php b/shop/cartupdate.php index df3e33785..45d5f7bdf 100644 --- a/shop/cartupdate.php +++ b/shop/cartupdate.php @@ -217,11 +217,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_order ) + ( 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 ) 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', '{$_POST['ct_order']}' )"; + $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' )"; $comma = ' , '; } @@ -333,18 +333,38 @@ else // 장바구니에 담기 else $ct_num = 0; + $ct_count = 0; $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 ) VALUES "; for($i=0; $i<$option_count; $i++) { + // 동일옵션의 상품이 있으면 수량 더함 + $sql2 = " select ct_id + from {$g4['shop_cart_table']} + where uq_id = '$tmp_uq_id' + and it_id = '{$_POST['it_id']}' + and io_id = '{$_POST['io_id'][$i]}' + and ct_status = '쇼핑' "; + $row2 = sql_fetch($sql2); + if($row2['ct_id']) { + $sql3 = " update {$g4['shop_cart_table']} + set ct_qty = ct_qty + {$_POST['ct_qty'][$i]} + where ct_id = '{$row2['ct_id']}' "; + sql_query($sql3); + + continue; + } + $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]}', '$ct_num', '{$_POST['io_id'][$i]}', '{$_POST['io_type'][$i]}', '{$_POST['io_price'][$i]}', '".G4_TIME_YMDHIS."', '$REMOTE_ADDR', '$sw_direct' )"; $comma = ' , '; $ct_num++; + $ct_count++; } - sql_query($sql); + if($ct_count > 0) + sql_query($sql); } }