diff --git a/erpnext/public/js/wishlist.js b/erpnext/public/js/wishlist.js index 6ab1906b60..b2c840a4d5 100644 --- a/erpnext/public/js/wishlist.js +++ b/erpnext/public/js/wishlist.js @@ -8,24 +8,23 @@ $.extend(wishlist, { set_wishlist_count: function() { // set badge count for wishlist icon var wish_count = frappe.get_cookie("wish_count"); - if(frappe.session.user==="Guest") { + if (frappe.session.user==="Guest") { wish_count = 0; } - if(wish_count) { + if (wish_count) { $(".wishlist").toggleClass('hidden', false); } var $wishlist = $('.wishlist-icon'); var $badge = $wishlist.find("#wish-count"); - if(parseInt(wish_count) === 0 || wish_count === undefined) { + if (parseInt(wish_count) === 0 || wish_count === undefined) { $wishlist.css("display", "none"); - } - else { + } else { $wishlist.css("display", "inline"); } - if(wish_count) { + if (wish_count) { $badge.html(wish_count); $wishlist.addClass('cart-animate'); setTimeout(() => { @@ -129,18 +128,21 @@ $.extend(wishlist, { } frappe.call({ + async: async, type: "POST", method: method, args: args, callback: function (r) { if (r.exc) { - if (failure_action && (typeof failure_action === 'function')) {failure_action();} + if (failure_action && (typeof failure_action === 'function')) { + failure_action(); + } frappe.msgprint({ message: __("Sorry, something went wrong. Please refresh."), indicator: "red", title: __("Note") }); - } else { - if (success_action && (typeof success_action === 'function')) {success_action();} + } else if (success_action && (typeof success_action === 'function')) { + success_action(); } } }); diff --git a/erpnext/templates/pages/wishlist.py b/erpnext/templates/pages/wishlist.py index 15aef873ff..0dbcf2188a 100644 --- a/erpnext/templates/pages/wishlist.py +++ b/erpnext/templates/pages/wishlist.py @@ -5,7 +5,6 @@ from __future__ import unicode_literals no_cache = 1 import frappe -from erpnext.e_commerce.shopping_cart.cart import get_cart_quotation def get_context(context): settings = frappe.get_doc("E Commerce Settings")