From 5f1eebec164237e9b30a78080cd2ab2362f5cf57 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Wed, 1 May 2019 14:32:15 +0530 Subject: [PATCH 1/2] fix(cart): Don't use window.open as it can be blocked window.open calls are interpreted as popups by some browsers and are blocked. Also, route to Quotation web view instead of printview. --- erpnext/templates/includes/cart.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/erpnext/templates/includes/cart.js b/erpnext/templates/includes/cart.js index 983898b457..f26aff487f 100644 --- a/erpnext/templates/includes/cart.js +++ b/erpnext/templates/includes/cart.js @@ -162,8 +162,7 @@ $.extend(shopping_cart, { .html(msg || frappe._("Something went wrong!")) .toggle(true); } else { - window.open('/orders/' + encodeURIComponent(r.message), '_blank'); - window.location.reload(); + window.location.href = '/orders/' + encodeURIComponent(r.message); } } }); @@ -186,8 +185,7 @@ $.extend(shopping_cart, { .html(msg || frappe._("Something went wrong!")) .toggle(true); } else { - window.open('/printview?doctype=Quotation&name=' + r.message, '_blank'); - window.location.reload(); + window.location.href = '/quotations/' + encodeURIComponent(r.message); } } }); From 358329d7df9d236ac2ce645ddf8a3d2de90175e5 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Wed, 1 May 2019 14:56:50 +0530 Subject: [PATCH 2/2] fix: Hide button and cart after success --- erpnext/templates/includes/cart.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/erpnext/templates/includes/cart.js b/erpnext/templates/includes/cart.js index f26aff487f..4c35dd04a2 100644 --- a/erpnext/templates/includes/cart.js +++ b/erpnext/templates/includes/cart.js @@ -162,6 +162,8 @@ $.extend(shopping_cart, { .html(msg || frappe._("Something went wrong!")) .toggle(true); } else { + $('.cart-container table').hide(); + $(btn).hide(); window.location.href = '/orders/' + encodeURIComponent(r.message); } } @@ -185,6 +187,8 @@ $.extend(shopping_cart, { .html(msg || frappe._("Something went wrong!")) .toggle(true); } else { + $('.cart-container table').hide(); + $(btn).hide(); window.location.href = '/quotations/' + encodeURIComponent(r.message); } }