[FIX] website_sale_wishlist: prevent product to be added more than once

The add to wishlist button will only be disabled once the RPC gets back to the
client.
Thus, the button being grayed out will occur depending of the connection speed.
If the RPC does not get back almost instantaneous, the user will be able to
click multiple times on the button and add the product more than once.

This commit fixes that behavior by disabling the button when the user click on
it.

Closes #27489, closes #27735
This commit is contained in:
Romain Derie
2018-10-17 09:49:22 +00:00
parent 498dbc548b
commit a5a86c4d11
@@ -62,6 +62,7 @@ sAnimations.registry.ProductWishlist = sAnimations.Class.extend(ProductConfigura
productID = parseInt(productID, 10);
}
$el.prop("disabled", true).addClass('disabled');
var productReady = this.selectOrCreateProduct(
$el.closest('form'),
productID,
@@ -82,9 +83,12 @@ sAnimations.registry.ProductWishlist = sAnimations.Class.extend(ProductConfigura
self.wishlistProductIDs.push(productId);
self._updateWishlistView();
wSaleUtils.animateClone($('#my_wish'), $el.closest('form'), 25, 40);
$el.prop("disabled", true).addClass('disabled');
}).fail(function () {
$el.prop("disabled", false).removeClass('disabled');
});
}
}).fail(function () {
$el.prop("disabled", false).removeClass('disabled');
});
},
/**