From aeb75989cfb6eba8412a41938f2a7a5fc97c8ffe Mon Sep 17 00:00:00 2001 From: Senad Uka Date: Mon, 9 Feb 2015 04:44:59 +0100 Subject: [PATCH] fixed bugs with cart notification number --- front-ui/app/stores/cartStore.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/front-ui/app/stores/cartStore.js b/front-ui/app/stores/cartStore.js index 254ae8c..ed3f224 100644 --- a/front-ui/app/stores/cartStore.js +++ b/front-ui/app/stores/cartStore.js @@ -74,7 +74,17 @@ var CartStore = _.extend({}, EventEmitter.prototype, { getWholeCartState: function() { - var numberOfItems = _itemsInCart.models.filter(function(item) { return item.get('count') > 0 }).length; + var numberOfItems = 0; + + for (key in states) { + if(states.hasOwnProperty(key)){ + var value = states[key]; + if (value.get('count') > 0) { + numberOfItems++; + } + } + }; + var state = { count: numberOfItems };