From aca4733b12f2407d4b096ba70f5fe0e926a78864 Mon Sep 17 00:00:00 2001 From: thisgun Date: Fri, 20 Jan 2023 11:17:20 +0900 Subject: [PATCH] =?UTF-8?q?=EC=87=BC=ED=95=91=EB=AA=B0=20=EC=9E=A5?= =?UTF-8?q?=EB=B0=94=EA=B5=AC=EB=8B=88=EC=97=90=EC=84=9C=20=EC=9E=AC?= =?UTF-8?q?=EA=B3=A0=20=EC=9D=B4=EC=83=81=20=EC=A3=BC=EB=AC=B8=ED=95=A0?= =?UTF-8?q?=EC=88=98=20=EC=9E=88=EB=8A=94=20=EC=98=A4=EB=A5=98=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mobile/shop/orderform.sub.php | 9 +++++++++ shop/ajax.orderstock.php | 6 +++--- shop/cartupdate.php | 9 +++++++-- 3 files changed, 19 insertions(+), 5 deletions(-) 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'];