       @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: ->

            productType = $(addToCartBtn).data('product')

            if productType is "pupil"
              worldId = $(@worldConfigActiveClass).data('id')
              eyeId = $(@eyeConfigActiveClass).data('id')
              id = [worldId,eyeId]
              price = @_calcConfigSubTotal([@worldConfigActiveClass,@eyeConfigActiveClass,@licenseConfigActiveClass])
              specs = $(@worldConfigActiveClass).data('specs') + "," + $(@eyeConfigActiveClass).data('specs')
              license = $(@licenseConfigActiveClass).data('id')
            else 
              productType = $(addToCartBtn).data('product')
              id = [$(addToCartBtn).data('id')]
              price = $(addToCartBtn).data('cost')
              specs = $(addToCartBtn).data('specs')
              license = "not applicable"
          
            key = @_uniqueId()
            item = {
              "product" : productType
              "id": id
              "specs": specs
              "price": price
              "quantity": 1
              "license": license
            }
            # save to local storage & update the nav counter
            LocalStorage.set(key, JSON.stringify(item))
            @eventUpdateCartNavCounter()
          else
            return false

    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
