Fix validating quantity
parent
bc3e33dbb5
commit
7f750b4a3b
|
@ -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
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue