[FIX] website_sale: can't send coupon code after an ajax request
Before this commit, an user could only use the coupon form if he didn't perform any ajax request (eg: change quantity, already sent a code..). Since the cart html would be reinjected with theses ajax requests, the click event would not work afterward until the page got fully reload. Now, we changed the jquery click binding to work with dynamically injected DOM
This commit is contained in:
@@ -215,7 +215,7 @@ odoo.define('website_sale.website_sale', function (require) {
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.oe_website_sale .a-submit, #comment .a-submit').off('click').on('click', function (event) {
|
||||
$('.oe_website_sale, #comment').off('click', '.a-submit').on('click', '.a-submit', function (event) {
|
||||
if (!event.isDefaultPrevented() && !$(this).is(".disabled")) {
|
||||
event.preventDefault();
|
||||
$(this).closest('form').submit();
|
||||
|
||||
@@ -35,7 +35,7 @@ $('.oe_website_sale #add_to_cart, .oe_website_sale #products_grid .a-submit')
|
||||
$(this).remove();
|
||||
});
|
||||
|
||||
$modal.on('click', '.a-submit', function () {
|
||||
$modal.on('click', '.a-submit', function (ev) {
|
||||
var $a = $(this);
|
||||
$form.ajaxSubmit({
|
||||
url: '/shop/cart/update_option',
|
||||
@@ -50,6 +50,7 @@ $('.oe_website_sale #add_to_cart, .oe_website_sale #products_grid .a-submit')
|
||||
}
|
||||
});
|
||||
$modal.modal('hide');
|
||||
ev.preventDefault();
|
||||
});
|
||||
|
||||
$modal.on('click', '.css_attribute_color input', function (event) {
|
||||
|
||||
Reference in New Issue
Block a user