diff --git a/lib/shop.lib.php b/lib/shop.lib.php index 2e287244c..f3e59be3c 100644 --- a/lib/shop.lib.php +++ b/lib/shop.lib.php @@ -167,11 +167,13 @@ function get_it_stock_qty($it_id) } // 옵션의 재고 (창고재고수량 - 주문대기수량) -function get_option_stock_qty($it_id, $io_id) +function get_option_stock_qty($it_id, $io_id, $type) { global $g4; - $sql = " select io_stock_qty from {$g4['shop_item_option_table']} where it_id = '$it_id' and io_id = '$io_id' and io_use = '1' "; + $sql = " select io_stock_qty + from {$g4['shop_item_option_table']} + where it_id = '$it_id' and io_id = '$io_id' and io_type = '$type' and io_use = '1' "; $row = sql_fetch($sql); $jaego = (int)$row['io_stock_qty']; @@ -180,6 +182,7 @@ function get_option_stock_qty($it_id, $io_id) from {$g4['shop_cart_table']} where it_id = '$it_id' and io_id = '$io_id' + and io_type = '$type' and ct_stock_use = 0 and ct_status in ('주문', '준비') "; $row = sql_fetch($sql); diff --git a/shop/cartupdate.php b/shop/cartupdate.php index 2985141e6..2fba3716d 100644 --- a/shop/cartupdate.php +++ b/shop/cartupdate.php @@ -197,7 +197,7 @@ else // 장바구니에 담기 if(!$_POST['io_id'][$i]) $it_stock_qty = get_it_stock_qty($_POST['it_id']); else - $it_stock_qty = get_option_stock_qty($_POST['it_id'], $_POST['io_id'][$i]); + $it_stock_qty = get_option_stock_qty($_POST['it_id'], $_POST['io_id'][$i], $_POST['io_type'][$i]); if ($ct_qty + $sum_qty > $it_stock_qty) {