$it_stock_qty) { alert($io_value." 의 재고수량이 부족합니다.\\n\\n현재 재고수량 : " . number_format($it_stock_qty) . " 개"); } } //-------------------------------------------------------- // 바로구매에 있던 장바구니 자료를 지운다. if($i == 0) sql_query(" delete from {$g5['shop_cart_table']} where od_id = '$tmp_cart_id' and ct_direct = 1 ", false); // 옵션수정일 때 기존 장바구니 자료를 먼저 삭제 if($act == 'optionmod') sql_query(" delete from {$g5['shop_cart_table']} where od_id = '$tmp_cart_id' and it_id = '$it_id' "); // 장바구니에 Insert // 바로구매일 경우 장바구니가 체크된것으로 강제 설정 if($sw_direct) $ct_select = 1; else $ct_select = 0; // 장바구니에 Insert $comma = ''; $sql = " INSERT INTO {$g5['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_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++) { $io_id = $_POST['io_id'][$it_id][$k]; $io_type = $_POST['io_type'][$it_id][$k]; $io_value = $_POST['io_value'][$it_id][$k]; // 옵션정보가 존재하는데 선택된 옵션이 없으면 건너뜀 if($lst_count && $io_id == '') continue; // 구매할 수 없는 옵션은 건너뜀 if($io_id && !$opt_list[$io_type][$io_id]['use']) continue; $io_price = $opt_list[$io_type][$io_id]['price']; $ct_qty = $_POST['ct_qty'][$it_id][$k]; // 동일옵션의 상품이 있으면 수량 더함 $sql2 = " select ct_id from {$g5['shop_cart_table']} where od_id = '$tmp_cart_id' and it_id = '$it_id' and io_id = '$io_id' and ct_status = '쇼핑' "; $row2 = sql_fetch($sql2); if($row2['ct_id']) { $sql3 = " update {$g5['shop_cart_table']} set ct_qty = ct_qty + '$ct_qty' where ct_id = '{$row2['ct_id']}' "; sql_query($sql3); 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', '{$it['it_notax']}', '$io_id', '$io_type', '$io_price', '".G5_TIME_YMDHIS."', '$REMOTE_ADDR', '$ct_send_cost', '$sw_direct', '$ct_select' )"; $comma = ' , '; $ct_count++; } if($ct_count > 0) sql_query($sql); } } // 바로 구매일 경우 if ($sw_direct) { if ($is_member) { goto_url(G5_SHOP_URL."/orderform.php?sw_direct=$sw_direct"); } else { goto_url(G5_BBS_URL."/login.php?url=".urlencode(G5_SHOP_URL."/orderform.php?sw_direct=$sw_direct")); } } else { goto_url(G5_SHOP_URL.'/cart.php'); } ?>