[FIX] website_sale: "Add to Cart" button with inactive variants

When clicking on "Add to Cart" button(a link in fact) with an
inactive variant in the Shop, the button must be disabled.
As "Add to Cart" is a link, the attribute "disabled" had no effect
on.

opw:657967
This commit is contained in:
Goffin Simon
2015-12-01 15:46:28 +01:00
parent dd92bd2a06
commit fc2295d8eb
@@ -211,7 +211,7 @@ $('.oe_website_sale').each(function () {
});
$('.oe_website_sale .a-submit, #comment .a-submit').off('click').on('click', function (event) {
if (!event.isDefaultPrevented()) {
if (!event.isDefaultPrevented() && !$(this).is(".disabled")) {
$(this).closest('form').submit();
}
});
@@ -308,11 +308,11 @@ $('.oe_website_sale').each(function () {
if (product_id) {
$parent.removeClass("css_not_available");
$product_id.val(product_id);
$parent.find(".js_check_product").removeAttr("disabled");
$parent.find("#add_to_cart").removeClass("disabled");
} else {
$parent.addClass("css_not_available");
$product_id.val(0);
$parent.find(".js_check_product").attr("disabled", "disabled");
$parent.find("#add_to_cart").addClass("disabled");
}
});