 # PLUGIN ENTRY POINT
 $.fn.buyButton = (productId, buyData, jsOptions) ->
 	defaultOptions = $.extend true, {}, $.fn.buyButton.defaults
-	element = this[this.length-1]
-	do (element) =>
+	for element in this
 		$element = $(element)
 		domOptions = $element.data()
 		options = $.extend(true, defaultOptions, domOptions, jsOptions)


		@accessories = []

		@init()

	init: =>
		@getChangesFromHREF()
		@bindEvents()
		@update()

# CLASSES
class BuyButton extends ProductComponent
	constructor: (@element, @productId, buyData = {}, @options) ->
		@sku = buyData.sku || null
		@quantity = buyData.quantity || 1
		@seller = buyData.seller || 1
