SzymonBl Posted October 16 Share Posted October 16 (edited) So I've got this problem, where I need to put some sort of limit, on the input: I know that it is impossible to buy more, than there is products in stock. But it is not enough, and I need to set limit, so that you can't choose more then there is in stock. I somehow managed to limit this using ChatGPT, but it works only if I'm typing the amount by myself. If anyone knows the solution, by script or addon (I can't find anything), I would be very glad. Edited October 21 by SzymonBl (see edit history) Link to comment Share on other sites More sharing options...
Prestashop Addict Posted October 17 Share Posted October 17 Please can you specify PS, PHP and theme versions Link to comment Share on other sites More sharing options...
SzymonBl Posted October 17 Author Share Posted October 17 1 minute ago, Prestashop Addict said: Please can you specify PS, PHP and theme versions PS is 1.7.7.1 PHP is 7.4 Link to comment Share on other sites More sharing options...
Prestashop Addict Posted October 17 Share Posted October 17 If you have set the option don't sell product out of stock, it's native with ajax calls. May be a theme issue, js feature not implemented or js error check console in browser. Link to comment Share on other sites More sharing options...
SzymonBl Posted October 18 Author Share Posted October 18 I mean, it is set, that I can't buy more than there is in stock. But what I need, is to set cap\limit, to the counter, so I can't set more then there is in stock. Link to comment Share on other sites More sharing options...
Prestashop Addict Posted October 18 Share Posted October 18 I understood your request 😉 What is your theme? Does it implement all Prestashop requirements for ajax calls? Have a look in Network tab in browser console, and check if there is any xhr call when your click on increment button or enter a value in qty box. Link to comment Share on other sites More sharing options...
SzymonBl Posted October 18 Author Share Posted October 18 The theme I use is Etrend Lite. And here are some calls, when I click arrows Link to comment Share on other sites More sharing options...
Prestashop Addict Posted October 18 Share Posted October 18 Check the response tab at right of the console and see if there is disabled tag in the input html Link to comment Share on other sites More sharing options...
SzymonBl Posted October 18 Author Share Posted October 18 I can't seem to find wny response tab Link to comment Share on other sites More sharing options...
Prestashop Addict Posted October 18 Share Posted October 18 Link to comment Share on other sites More sharing options...
SzymonBl Posted October 18 Author Share Posted October 18 The only "disabled" tag I see is in "Add to cart" button ... data-button-action=\"add-to-cart\"\n type=\"submit\"\n disabled\n >\n Dodaj do koszyka\n <\/button> ... Link to comment Share on other sites More sharing options...
Prestashop Addict Posted October 18 Share Posted October 18 So normally if your theme is Prestashop compatible, when qty requested exceed stock button add to cart is disabled. If no ask theme author 1 Link to comment Share on other sites More sharing options...
SzymonBl Posted October 19 Author Share Posted October 19 I'll see what else I can do. Thank you for your help Link to comment Share on other sites More sharing options...
SzymonBl Posted October 19 Author Share Posted October 19 At the end I just found some custom code for a "add to cart" button, and it works great Link to comment Share on other sites More sharing options...
Prestashop Addict Posted October 21 Share Posted October 21 Don't forget to change your title post by adding [SOLVED] and add a Thanks or Like to the good answer, this will help community. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now