[fixes] display cart count only if item exist in cart
This commit is contained in:
parent
69f9975748
commit
403ad48364
@ -4,13 +4,12 @@
|
||||
// shopping cart
|
||||
frappe.provide("shopping_cart");
|
||||
|
||||
$(function() {
|
||||
frappe.ready(function() {
|
||||
// update user
|
||||
if(full_name) {
|
||||
$('.navbar li[data-label="User"] a')
|
||||
.html('<i class="icon-fixed-width icon-user"></i> ' + full_name);
|
||||
}
|
||||
|
||||
// update login
|
||||
shopping_cart.set_cart_count();
|
||||
});
|
||||
@ -46,7 +45,7 @@ $.extend(shopping_cart, {
|
||||
var $cart = $('.cart-icon');
|
||||
var $badge = $cart.find("#cart-count");
|
||||
|
||||
if(cart_count === "0") {
|
||||
if(parseInt(cart_count) === 0) {
|
||||
$cart.css("display", "none");
|
||||
}
|
||||
else {
|
||||
|
@ -28,17 +28,7 @@ def update_website_context(context):
|
||||
cart_enabled = is_cart_enabled()
|
||||
context["shopping_cart_enabled"] = cart_enabled
|
||||
|
||||
# if cart_enabled:
|
||||
# post_login = [
|
||||
# {"label": _("Cart"), "url": "cart", "class": "cart-count"},
|
||||
# {"class": "divider"}
|
||||
# ]
|
||||
# context["post_login"] = post_login + context.get("post_login", [])
|
||||
|
||||
def update_my_account_context(context):
|
||||
if is_cart_enabled():
|
||||
context["my_account_list"].append({"label": _("Cart"), "url": "cart"})
|
||||
|
||||
context["my_account_list"].extend([
|
||||
{"label": _("Orders"), "url": "orders"},
|
||||
{"label": _("Invoices"), "url": "invoices"},
|
||||
|
Loading…
x
Reference in New Issue
Block a user