 		@options = $.extend {}, $.fn.minicart.defaults, options
 		@context = context
 		@hoverContext = @context.add('.show-minicart-on-hover')
-		@cartData = @options.cartData	# default {}
+		@cartData = {}
 
 		@base = $('.minicartListBase').remove()
 
 		@bindEvents()
 
-		@getData().success (data) =>
-			@cartData = data
-			@updateCart data
+		@updateData().success @updateCart
 
 		$(window).trigger "minicartLoaded"
 

				# console.log "Error Message: " + textStatus
				# console.log "HTTP Error: " + errorThrown

	showMinicart: =>
		@getData().done =>
			@updateItems data
			$(".vtexsc-cart").slideDown()
			clearTimeout @timeoutToHide
			@timeoutToHide = setTimeout ->
				$(".vtexsc-cart").slideUp()
			, 3000

	valueLabel: (value) =>
		@options.valuePrefix + _.formatCurrency(value/100, @options) + @options.valueSufix

	availabilityCode: (item) =>
		item.availability or "available"

	availabilityMessage: (item) =>
		@options.availabilityMessages[@availabilityCode(item)]


#

			# console.log "Error Message: " + textStatus
			# console.log "HTTP Error: " + errorThrown

	updateCart: () =>
		@updateValues()
		@updateItems()

	updateValues: =>
		total = 0
		for subtotal in @cartData.totalizers when subtotal.id is 'Items'
			total += subtotal.value

		$(".vtexsc-text", @context).text(@getValueLabel(total))

	updateItems: =>
		container = $(".minicartListContainer", @context).empty()
		for item, i in @cartData.items
			current = @base.clone()

			current.find('.cartSkuImage a').attr('href', item.detailUrl)
			current.find('.cartSkuImage img').attr('alt', item.name).attr('src', item.imageUrl)
			current.find('.cartSkuName a').attr('href', item.detailUrl).text(item.name)
			current.find('.cartSkuName .availability').text(@getAvailabilityMessage(item)).addClass("availability-#{@getAvailabilityCode(item)}")
			current.find('.cartSkuPrice .bestPrice').text(@getValueLabel(item.price))
			current.find('.cartSkuQuantity .cartSkuQttTxt').text(item.quantity)

			current.appendTo(container)
