diff --git a/js/shop.js b/js/shop.js index 2f94012f2..159814ca5 100644 --- a/js/shop.js +++ b/js/shop.js @@ -250,6 +250,7 @@ $(function() { // 선택옵션 추가처리 function sel_option_process(add_exec) { + var it_price = parseInt($("input#it_price").val()); var id = ""; var value, info, sel_opt, item, price, stock, run_error = false; var option = sep = ""; @@ -285,6 +286,12 @@ function sel_option_process(add_exec) price = info[1]; stock = info[2]; + // 금액 음수 체크 + if(it_price + parseInt(price) < 0) { + alert("구매금액이 음수인 상품은 구매할 수 없습니다."); + return false; + } + if(add_exec) { if(same_option_check(option)) return; @@ -317,6 +324,12 @@ function sel_supply_process($el, add_exec) var price = info[1]; var stock = info[2]; + // 금액 음수 체크 + if(parseInt(price) < 0) { + alert("구매금액이 음수인 상품은 구매할 수 없습니다."); + return false; + } + if(add_exec) { if(same_option_check(option)) return; diff --git a/shop/cartupdate.php b/shop/cartupdate.php index 4e9383508..d96ca0981 100644 --- a/shop/cartupdate.php +++ b/shop/cartupdate.php @@ -215,6 +215,15 @@ else // 장바구니에 담기 $io_price = $opt_list[$io_type][$io_id]['price']; $ct_qty = $_POST['ct_qty'][$it_id][$k]; + // 구매가격이 음수인지 체크 + if($io_type) { + if((int)$io_price < 0) + alert('구매금액이 음수인 상품은 구매할 수 없습니다.'); + } else { + if((int)$it['it_price'] + (int)$io_price < 0) + alert('구매금액이 음수인 상품은 구매할 수 없습니다.'); + } + // 동일옵션의 상품이 있으면 수량 더함 $sql2 = " select ct_id from {$g5['g5_shop_cart_table']}