Sha256: a16dcc271facb1dd0de4f196c0866e5c75cbd7422909a3aa30cb15dc2ee98a06

Contents?: true

Size: 1.72 KB

Versions: 1

Compression:

Stored size: 1.72 KB

Contents

<div class="simple_variant_options">
	<% if object.reflections.keys.include?(:piggybak_sellable) -%>
		<% optionArray = Hash.new -%>
		<% object.piggybak_sellable.each do |sellable| -%>
			<% if sellable.active -%>
				<% if sellable.quantity > 0 || sellable.unlimited_inventory -%>
					<% sellable.variant.option_values.each do |option_value| -%>
						<% if optionArray.empty? || optionArray[option_value.option].blank? -%>
							<% optionArray[option_value.option] = [] -%>
							<% optionArray[option_value.option] << option_value -%>
						<% else -%>
							<% if !optionArray[option_value.option].include? option_value -%>
								<% optionArray[option_value.option] << option_value -%>
							<% end -%>
						<% end -%>
					<% end -%>
				<% end -%>
			<% end -%>
		<% end -%>

		<script type="text/javascript">
			var simple_variant_map = <%= raw simple_variant_map(object) %>;
		</script>
		
		<% optionArray.each do |option, option_values| -%>
			<div class="option" id="option_<%= option.id %>">
				<h4><%= option.name %></h4>
				<% option_values.each do |option_value| -%>
					<input type="radio" name="option_<%= option.id %>" value="<%= option_value.id %>" class="piggybak-cart-option" />
					<%= option_value.name %><br />
				<% end -%>
			</div>
		<% end -%>
		<span class="all_selected">You must select an choice from each option.</span>
		<span class="unavailable">This combination is not available.</span>
		<%= form_tag piggybak.cart_add_url do -%>
			<input type="hidden" id="sellable_id" name="sellable_id" />
			<div id="variant_price">Price: <span></span></div>
			<label for="quantity">Quantity</label>
			<%= text_field_tag :quantity, 1 %>
			<%= submit_tag "Add to Cart", :id => "submit" %>
		<% end -%>
	<% end -%>
</div>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
piggybak_simple_variants-0.1.2 app/views/piggybak_simple_variants/cart/_radio_buttons_form.html.erb