       @eventUpdateCartNavCounter()
 
   eventUpdateCartNavCounter: ->
-    counter = if LocalStorage.length() > 0 then LocalStorage.length() else ""
+    qty = [v.qty for k,v of LocalStorage.dict()]
+    qtySum = qty[0].reduce (a,b) -> a + b
+    counter = if LocalStorage.length() > 0 then qtySum else ""
     $(@cartNavCounter).text("#{ counter }")
 
   eventUpdateConfig: ->


  eventAddToCart: ->
    if $(@storePage).length > 0
      @addToCartButton.click (event)=>
          event.preventDefault()
          addToCartBtn = $(event.target)
          if not $(@addToCartBtn).hasClass('Button--state-inactive')

    id.substr 0, len
    return id

  _arrayEqual: (a, b) ->
    # a.length is b.length and 
    a.every (elem, i) -> elem is b[i]

  _compareOrders: (orderItems)->
    if LocalStorage.length() > 0
      for k,v of LocalStorage.dict()
        console.log v.order
        console.log orderItems
        if @_arrayEqual(v.order,orderItems)
          return k


$(document).ready ->
  s = new PupilStore
