Jump to content

When minimal quantity for sale set, not possible to enter quantity by keyboard


Birze

Recommended Posts

Hi,

Prestashop 1.7.8.11

On backend, in product combination enter minimal quanity for sale: 50

Then, on frontend product page, when trying to enter quantity 100 by keyboard (or any value from 100 to 499), the quantity jumps back to 50.

Capture.PNG

Link to comment
Share on other sites

Apparently the problem is in theme.js file.

Someone suggested to change

 ("" === t.val() || t.val() < t.attr("min")) && (t.val(t.attr("min")), t.trigger("change"))

with
 

("" === t.val() || **parseInt**(t.val()) < **parseInt**(t.attr("min"))) && (t.val(t.attr("min")), t.trigger("change"))

But something is not quite right. It removed the problem, but now arrows are missing and "Add to Cart" button doesn't work

Link to comment
Share on other sites

Looks like this is the correct code that works. In theme.js change:

t.focusout(function(){(""===t.val()||t.val()<t.attr("min"))&&(t.val(t.attr("min")),t.trigger("change"))})

to:

t.focusout(function(){(""===t.val()||parseInt(t.val())<parseInt(t.attr("min")))&&(t.val(t.attr("min")),t.trigger("change"))})

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...