From fc2295d8ebb3e8d207d91052634bf1433419e697 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 1 Dec 2015 13:34:47 +0100 Subject: [PATCH] [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 --- addons/website_sale/static/src/js/website_sale.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/website_sale/static/src/js/website_sale.js b/addons/website_sale/static/src/js/website_sale.js index c316f69d53c..66d2985e43f 100644 --- a/addons/website_sale/static/src/js/website_sale.js +++ b/addons/website_sale/static/src/js/website_sale.js @@ -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"); } });