Post by pavvelbe » Tue Nov 29, 2022 12:56 am

Hello,

I am trying to change a standard product quantity box.
My main problem, that this field is a text field... in product.twig:
<input type="text" name="quantity" value="{{ minimum }}" size="2" id="input-quantity" class="form-control" />
If I change the input type from TEXT to NUMBER (and I also want to add skip="10" etc), add to cart button doesn't work correctly.
It does'nt matter what I write, it always add "1" product to the cart.

I am despered. I don't know where to look for the problem. Maby I need to change something in button ID (button-cart)?
But I don't know where to find all function of button-cart ID...

Maby someone can give me any advice?

Newbie

Posts

Joined
Thu Dec 13, 2012 4:30 pm

Post by ADD Creative » Tue Nov 29, 2022 8:48 am

In catalog/view/theme/default/template/product/product.twig you need to add your input to the following.

Code: Select all

data: $('#product input[type=\'text\'], #product input[type=\'hidden\'], #product input[type=\'radio\']:checked, #product input[type=\'checkbox\']:checked, #product select, #product textarea'),

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by pavvelbe » Wed Nov 30, 2022 3:57 am

Dear Add Creative,

Where I should add this? I add your code in input section like this
<input type="number" name="quantity" value="{{ minimum }}" size="2" id="input-quantity" class="form-control" data: $('#product input[type=\'text\'], #product input[type=\'hidden\'], #product input[type=\'radio\']:checked, #product input[type=\'checkbox\']:checked, #product select, #product textarea');/>
and still have the same problem. If I want to add eg. 10 x product, always adds only one to the cart :(

ADD Creative wrote:
Tue Nov 29, 2022 8:48 am
In catalog/view/theme/default/template/product/product.twig you need to add your input to the following.

Code: Select all

data: $('#product input[type=\'text\'], #product input[type=\'hidden\'], #product input[type=\'radio\']:checked, #product input[type=\'checkbox\']:checked, #product select, #product textarea'),

Newbie

Posts

Joined
Thu Dec 13, 2012 4:30 pm

Post by ADD Creative » Wed Nov 30, 2022 6:48 pm

You don't add it, you need to find and change it.

Maybe to something like the following.

Code: Select all

data: $('#product input[type=\'number\'], #product input[type=\'text\'], #product input[type=\'hidden\'], #product input[type=\'radio\']:checked, #product input[type=\'checkbox\']:checked, #product select, #product textarea'),

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by pavvelbe » Fri Dec 02, 2022 7:31 am

You are awsome :) It works! THANK YOU A LOT!
ADD Creative wrote:
Wed Nov 30, 2022 6:48 pm
You don't add it, you need to find and change it.

Maybe to something like the following.

Code: Select all

data: $('#product input[type=\'number\'], #product input[type=\'text\'], #product input[type=\'hidden\'], #product input[type=\'radio\']:checked, #product input[type=\'checkbox\']:checked, #product select, #product textarea'),

Newbie

Posts

Joined
Thu Dec 13, 2012 4:30 pm
Who is online

Users browsing this forum: alanjones and 89 guests