diff --git a/lib/shop.lib.php b/lib/shop.lib.php index cfadc8562..8e770de07 100644 --- a/lib/shop.lib.php +++ b/lib/shop.lib.php @@ -173,7 +173,7 @@ function get_option_stock_qty($it_id, $io_id) $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' "; $row = sql_fetch($sql); - $jaego = (int)$row['it_stock_qty']; + $jaego = (int)$row['io_stock_qty']; // 재고에서 빼지 않았고 주문인것만 $sql = " select SUM(ct_qty) as sum_qty diff --git a/shop/cartupdate.php b/shop/cartupdate.php index 64918ec15..1d510bc59 100644 --- a/shop/cartupdate.php +++ b/shop/cartupdate.php @@ -157,7 +157,7 @@ else // 장바구니에 담기 // 옵션정보를 얻어서 배열에 저장 $opt_list = array(); - $sql = " select * from {$g4['shop_item_option_table']} where it_id = '{$_POST['it_id']}' and io_use = '1' order io_no asc "; + $sql = " select * from {$g4['shop_item_option_table']} where it_id = '{$_POST['it_id']}' and io_use = '1' order by io_no asc "; $result = sql_query($sql); for($i=0; $row=sql_fetch_array($result); $i++) { $opt_list[$row['io_type']][$row['io_id']]['price'] = $row['io_price']; @@ -197,7 +197,7 @@ else // 장바구니에 담기 for($i=0; $i<$option_count; $i++) { $sql = " select SUM(ct_qty) as cnt from {$g4['shop_cart_table']} where it_id = '{$_POST['it_id']}' - and uq_id = '$tmp_uq_id', + and uq_id = '$tmp_uq_id' and io_id = '{$_POST['io_id'][$i]}' "; $row = sql_fetch($sql); $sum_qty = $row['cnt']; @@ -233,7 +233,7 @@ else // 장바구니에 담기 VALUES "; for($i=0; $i<$option_count; $i++) { - $sql .= $comma."( '$tmp_uq_id', '{$_POST['it_id']}', '{$_POST['it_name']}', '쇼핑', '{$_POST['it_price']}', '{$_POST['it_point']}', '0', '0', '{$_POST[['io_value'][$i]}', '{$_POST['ct_qty'][$i]}', '{$_POST['io_id'][$i]}', '{$_POST['io_type'][$i]}', '{$_POST['io_price']}', '".G4_TIME_YMDHIS."', '$REMOTE_ADDR', '$sw_direct' )"; + $sql .= $comma."( '$tmp_uq_id', '{$_POST['it_id']}', '{$_POST['it_name']}', '쇼핑', '{$_POST['it_price']}', '{$_POST['it_point']}', '0', '0', '{$_POST['io_value'][$i]}', '{$_POST['ct_qty'][$i]}', '{$_POST['io_id'][$i]}', '{$_POST['io_type'][$i]}', '{$_POST['io_price'][$i]}', '".G4_TIME_YMDHIS."', '$REMOTE_ADDR', '$sw_direct' )"; $comma = ' , '; } diff --git a/shop/item.php b/shop/item.php index c942eaf42..facccf734 100644 --- a/shop/item.php +++ b/shop/item.php @@ -185,6 +185,7 @@ else
+ @@ -299,7 +300,7 @@ else 판매가격 원 - + @@ -688,6 +689,7 @@ else } }); + $("input[name=total_price]").val(total); $("#sit_tot_price").empty().html("총 금액 : "+number_format(String(total))+"원"); } @@ -922,16 +924,10 @@ else return; } - for (i=1; i<=6; i++) + if($("input[name='io_id[]']").size() < 1) { - if (typeof(f.elements["it_opt"+i]) != 'undefined') - { - if (f.elements["it_opt"+i].value == '선택') { - alert(f.elements["it_opt"+i+"_subject"].value + '을(를) 선택하여 주십시오.'); - f.elements["it_opt"+i].focus(); - return; - } - } + alert("상품의 선택옵션을 선택해 주십시오."); + return false; } if (act == "direct_buy") { @@ -940,22 +936,31 @@ else f.sw_direct.value = 0; } - if (!f.ct_qty.value) { - alert("수량을 입력해 주십시오."); - f.ct_qty.focus(); - return; - } else if (isNaN(f.ct_qty.value)) { - alert("수량을 숫자로 입력해 주십시오."); - f.ct_qty.select(); - f.ct_qty.focus(); - return; - } else if (parseInt(f.ct_qty.value) < 1) { - alert("수량은 1 이상 입력해 주십시오."); - f.ct_qty.focus(); - return; - } + var val, result = true; + $("input[name='ct_qty[]']").each(function() { + val = $(this).val(); - amount_change(); + if(val.length < 1) { + alert("수량을 입력해 주십시오."); + result = false; + return false; + } + + if(val.replace(/[0-9]/g, "").length > 0) { + alert("수량은 숫자로 입력해 주십시오."); + result = false; + return false; + } + + if(parseInt(val.replace(/[^0-9]/g, "")) < 1) { + alert("수량은 1이상 입력해 주십시오."); + result = false; + return false; + } + }); + + if(!result) + return false; f.submit(); }