Sha256: eb070168e444da8ebec785971aa18b673b689d11efe177f95d9b212715275a59

Contents?: true

Size: 1.6 KB

Versions: 2

Compression:

Stored size: 1.6 KB

Contents

<% if @cart.items.any? -%>
<%= form_tag piggybak.cart_update_url do -%>
<table cellpadding="5" cellspacing="0" width="100%">
	<tr>
		<th>Item</th>
		<th>Price</th>
		<th>Quantity</th>
		<th>Subtotal</th>
		<% if page == "cart" -%>
		<th></th>
		<% end -%>
	</tr>
	<% @cart.items.each do |item| %>
	<tr>
		<td><%= item[:product].description %></td>
		<td><%= number_to_currency item[:product].price %></td>
		<td>
			<% if page == "cart" -%>
			<%= text_field_tag "quantity[#{item[:product].id}]", item[:quantity] %>
            <% else -%>
			<%= item[:quantity] %>
			<% end -%>
		</td>
		<td><%= number_to_currency item[:quantity]*item[:product].price %></td>
		<% if page == "cart" -%>
		<td>
			<%= link_to "Remove", piggybak.remove_item_url(item[:product].id), :method => :delete %>
		</td>
		<% end -%>
	</tr>
	<% end -%>
	<tr>
		<td colspan="<%= page == "cart" ? "5" : "4" %>"></td>
	</tr>
	<tr>
		<td colspan="<%= page == "cart" ? "3" : "2" %>"></td>
		<td>Subtotal</td>
		<td id="subtotal_total" data-total="<%= @cart.total %>"><%= number_to_currency @cart.total %></td>
	</tr>
	<% if page != "cart" -%>
	<tr>
		<td colspan="<%= page == "cart" ? "3" : "2" %>"></td>
		<td>Tax</td>
		<td id="tax_total"></td>
	</tr>
	<tr>
		<td colspan="<%= page == "cart" ? "3" : "2" %>"></td>
		<td>Shipping</td>
		<td id="shipping_total"></td>
	</tr>
	<tr>
		<td colspan="<%= page == "cart" ? "3" : "2" %>"></td>
		<td>Total</td>
		<td id="order_total"></td>
	</tr>
	<% end -%>
</table>

<% if page == "cart" %>
<%= submit_tag "Update", :id => "update" %>
<% end -%>

<% end -%>
<% else -%>
<p id="emtpy">
Your cart is empty.
</p>
<% end -%>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
piggybak-0.1.1 app/views/piggybak/cart/_items.html.erb
piggybak-0.1.0 app/views/piggybak/cart/_items.html.erb