From 0a33d4ffc58258fb65836db6908f6fa753d7cc9b Mon Sep 17 00:00:00 2001 From: Robert Kirschner Date: Tue, 21 Mar 2017 14:52:59 +0100 Subject: [PATCH 1/2] [fix] selecting new address in cart web page unchecks previously checked address --- erpnext/templates/includes/cart.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/erpnext/templates/includes/cart.js b/erpnext/templates/includes/cart.js index dbb93a94b10..93b5ae02970 100644 --- a/erpnext/templates/includes/cart.js +++ b/erpnext/templates/includes/cart.js @@ -24,6 +24,16 @@ $.extend(shopping_cart, { if($(this).prop("checked")) { var me = this; + // freeze ui and wait for response: + frappe.freeze(); + + // uncheck other shipping or billing addresses: + if ( $(this).is('input[data-fieldname=customer_address]') ) { + $('input[data-fieldname=customer_address]').not(this).prop('checked', false); + } else { + $('input[data-fieldname=shipping_address_name]').not(this).prop('checked', false); + } + return frappe.call({ type: "POST", method: "erpnext.shopping_cart.cart.update_cart_address", @@ -35,6 +45,8 @@ $.extend(shopping_cart, { if(!r.exc) { $(".cart-tax-items").html(r.message.taxes); } + // unfreeze: + frappe.unfreeze(); } }); } else { From c6b52a321e20b949174bf7005e0bb7e7014adac3 Mon Sep 17 00:00:00 2001 From: Robert Kirschner Date: Wed, 22 Mar 2017 08:10:30 +0100 Subject: [PATCH 2/2] update on cart.js pull request feedback --- erpnext/templates/includes/cart.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/erpnext/templates/includes/cart.js b/erpnext/templates/includes/cart.js index 93b5ae02970..ee98b23a922 100644 --- a/erpnext/templates/includes/cart.js +++ b/erpnext/templates/includes/cart.js @@ -24,9 +24,6 @@ $.extend(shopping_cart, { if($(this).prop("checked")) { var me = this; - // freeze ui and wait for response: - frappe.freeze(); - // uncheck other shipping or billing addresses: if ( $(this).is('input[data-fieldname=customer_address]') ) { $('input[data-fieldname=customer_address]').not(this).prop('checked', false); @@ -37,6 +34,7 @@ $.extend(shopping_cart, { return frappe.call({ type: "POST", method: "erpnext.shopping_cart.cart.update_cart_address", + freeze: true, args: { address_fieldname: $(this).attr("data-fieldname"), address_name: $(this).attr("data-address-name") @@ -45,8 +43,6 @@ $.extend(shopping_cart, { if(!r.exc) { $(".cart-tax-items").html(r.message.taxes); } - // unfreeze: - frappe.unfreeze(); } }); } else {