Fix validating quantity

master
Mark Moffat 2020-01-07 21:33:35 +10:30
parent bc3e33dbb5
commit 7f750b4a3b
4 changed files with 5 additions and 5 deletions

View File

@ -282,8 +282,8 @@ $(document).ready(function (){
$(document).on('click', '.product-add-to-cart', function(e){
var productOptions = getSelectedOptions();
if(parseInt($('#product_quantity').val()) < 0){
$('#product_quantity').val(0);
if(parseInt($('#product_quantity').val()) < 1){
$('#product_quantity').val(1);
}
$.ajax({

File diff suppressed because one or more lines are too long

View File

@ -366,7 +366,7 @@ router.post('/product/addtocart', async (req, res, next) => {
const productComment = req.body.productComment ? req.body.productComment : null;
// Don't allow negative quantity
if(productQuantity < 0){
if(productQuantity < 1){
productQuantity = 1;
}

View File

@ -76,7 +76,7 @@
<div class="input-group-prepend">
<button class="btn btn-outline-primary qty-btn-minus" type="button">-</button>
</div>
<input type="text" class="form-control add-color text-center" id="product_quantity" maxlength="3" value="1">
<input type="number" class="form-control add-color text-center" id="product_quantity" maxlength="3" value="1">
<div class="input-group-append">
<button class="btn btn-outline-primary qty-btn-plus" type="button">+</button>
</div>