Jump to content

Minimal quantity warning bugging with my multiple quantity feature


Recommended Posts

Hello everyone,

Apologizing in advance for my english.

I posted the same beginning for another topic but my bug isn't the same.

My shop is a B2B and it has products that are sold in sets of 2, 4, 10... depending of the product.

Let's take the product Blade sold by 10 as an example for my problem. We used to manage those products with attributes but now we are managing the sets with the minimal quantity of a product and we erased the attributes of those products.

I'm not a pro in JS but I've managed to change the product, the category and the summary cart/one page checkout page templates and js for the quantities to go by multiple of the minimal quantity. So if the blade is sold by ten, you will see "10" prefilled on those pages instead of 1 and then clicking the plus or minus button would add or remove "10" quantities.

I also add warnings if the quantity filled is wrong (add to cart disabled and a sentence in red that tells people to correct the quantities by a multiple of 10).

On the cart summary, as there are several product, I created a function on the js file that checks if each quantity is filled correctly or not. The result is True if it's not filled correctly and False if it's filled correctly. I put those trues and falses on an array with the array.push() js function and then I say "if there is at least one true on that array, put a big warning and do not display the following blocks" which prevents the client from pursuing the order.

The bug with the last functionality:

  • The minimal quantity feature of Prestashop adds a prompt warning when the quantity of the product is less than the minimal quantity. Let's say that on the summary cart, the blades have a quantity of 20 and I put 5 on the input, the warnings I put appears, the blocks after the summary table disappear and there is the prestashop prompt warning that tells me that 10 is the minimal quantity required. After that, the quantity 5 goes back to 20 (the quantity filled before). That's great but the warnings are still there because my function hasn't checked the quantities after this event. So event though the quantities are right, the client can't order because the block didn't reappear and the warning didn't disappear.

Does someone know where this prompt minimal quantity warning is so I can put my function after it?

Also does someone know where this "put back the previous quantity filled (20) instead of the wrong (5)" is ?

I hope I was clear in my explonation.

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...