diff --git a/mobile/shop/orderform.sub.php b/mobile/shop/orderform.sub.php index 71935a5f3..bcb44303d 100644 --- a/mobile/shop/orderform.sub.php +++ b/mobile/shop/orderform.sub.php @@ -1233,6 +1233,7 @@ var temp_point = 0; function pay_approval() { + // 무통장 아닌 가상계좌, 계좌이체, 휴대폰, 신용카드, 기타 등등 을 처리한다. // 재고체크 var stock_msg = order_stock_check(); if(stock_msg != "") { @@ -1435,6 +1436,14 @@ function pay_approval() function forderform_check() { + // 무통장만 여기에처 처리한다. + // 재고체크 + var stock_msg = order_stock_check(); + if(stock_msg != "") { + alert(stock_msg); + return false; + } + var f = document.forderform; // 필드체크 diff --git a/shop/ajax.orderstock.php b/shop/ajax.orderstock.php index ef685eac1..b37fcd867 100644 --- a/shop/ajax.orderstock.php +++ b/shop/ajax.orderstock.php @@ -42,15 +42,15 @@ if (function_exists('before_check_cart_price')) { } // 재고체크 -$sql = " select * +$sql = " select *, sum(ct_qty) as sum_ct_qty from {$g5['g5_shop_cart_table']} where od_id = '$tmp_cart_id' and ct_select = '1' - and ct_status = '쇼핑' "; + and ct_status = '쇼핑' GROUP BY od_id, it_id, it_name, ct_option, io_id, io_type "; $result = sql_query($sql); for($i=0; $row=sql_fetch_array($result); $i++) { - $ct_qty = $row['ct_qty']; + $ct_qty = $row['sum_ct_qty']; // 해당 상품이 품절 또는 판매중지 상태인지 체크합니다. $sql = " select it_soldout, it_use, ca_id, ca_id2, ca_id3 from {$g5['g5_shop_item_table']} where it_id = '".$row['it_id']."' "; diff --git a/shop/cartupdate.php b/shop/cartupdate.php index ad0887b6f..b8ba2848d 100644 --- a/shop/cartupdate.php +++ b/shop/cartupdate.php @@ -58,10 +58,14 @@ if($act == "buy") } // 주문 상품의 재고체크 - $sql = " select ct_qty, it_name, ct_option, io_id, io_type + // 동일 상품 옵션이 레코드에 있는 경우 재고를 제대로 체크하지 못하는 오류가 있음 + // $sql = " select ct_qty, it_name, ct_option, io_id, io_type from {$g5['g5_shop_cart_table']} where od_id = '$tmp_cart_id' and it_id = '$it_id' "; + + $sql = " select sum(ct_qty) as ct_qty, it_name, ct_option, io_id, io_type from {$g5['g5_shop_cart_table']} where od_id = '$tmp_cart_id' - and it_id = '$it_id' "; + and it_id = '$it_id' GROUP BY od_id, it_id, it_name, ct_option, io_id, io_type "; + $result = sql_query($sql); for($k=0; $row=sql_fetch_array($result); $k++) { @@ -73,6 +77,7 @@ if($act == "buy") and ct_stock_use = 0 and ct_status = '쇼핑' and ct_select = '1' "; + $sum = sql_fetch($sql); // $sum['cnt'] 가 null 일때 재고 반영이 제대로 안되는 오류 수정 (그누위즈님,210614) // $sum_qty = $sum['cnt'];