Prestashop: [BOOM-5683] Double click on "Add to cart" on the product page FO freezes the page

Created on 22 Aug 2018  路  4Comments  路  Source: PrestaShop/PrestaShop

This issue has been migrated from the Forge. Read the original ticket here.

  • _Reporter:_ Elitius
  • _Created at:_ Wed, 6 Jun 2018 01:42:57 +0200

Describe the bug

If you double click on "add to cart" on a product page in FO, the confimation modal is displayed but cannot be closed if you click on the cross or on "continue shipping", but you can proceed to checkout.

Expected behavior

I should be able to close the modal

Steps to Reproduce

Steps to reproduce the behavior:

  1. Go on a product page in FO
  2. Double click on "add to cart"
  3. Try to close the confirmation modal, you can't

Screenshots

https://drive.google.com/file/d/1ZMlOxzJDPdXoRdnQEgEGSUm-I_irCj_t/view?usp=sharing

Additional information

  • PrestaShop version: 1.7.7.x and before
  • PHP version: N/A
1.7.4.2 1.7.6.0 1.7.7.0 Bug FO Fixed Major Products Topwatchers

Most helpful comment

Maybe the user should not be allowed to click twice on the atc button that fast, as it could also create other unwanted issuses like adding more products than wanted. So a simple solution would be:

  1. After the first click on "add to cart", disable the button - $(this).attr("disabled",true);.
  2. Re enable the button after the "updatedCart" ajax event. -prestashop.on("updatedCart", function(event) {.....removeAttr("disabled");
    I will make a PR for this when I get the time if no one gets to it faster.

I did something similar in my custom theme looks like this (mind the multiple clicks): https://www.youtube.com/watch?v=MEMOgdikNBI&feature=youtu.be

All 4 comments

This comment has been migrated from the Forge. Read the original comment here.

  • _Author:_ khouloud.belguith
  • _Created at:_ Wed, 6 Jun 2018 11:37:51 +0200

Hi Simon,

I manage to reproduce the issue with the last version 1.7.3.3.
I attached a video record.
The best is yet to come' Framed poster.webm
We will see how to fix it.

Best regards, Khouloud

Maybe the user should not be allowed to click twice on the atc button that fast, as it could also create other unwanted issuses like adding more products than wanted. So a simple solution would be:

  1. After the first click on "add to cart", disable the button - $(this).attr("disabled",true);.
  2. Re enable the button after the "updatedCart" ajax event. -prestashop.on("updatedCart", function(event) {.....removeAttr("disabled");
    I will make a PR for this when I get the time if no one gets to it faster.

I did something similar in my custom theme looks like this (mind the multiple clicks): https://www.youtube.com/watch?v=MEMOgdikNBI&feature=youtu.be

Isn't it critical?

Well, this is actually kinda critical since the user's experience is affected negatively.
I've tried to disable the button onClick but won't send the correct parameters when submitting.
@rdy4ever can you please share the code you used to deactivate the button when processing the request?

Best regards

Was this page helpful?
0 / 5 - 0 ratings