Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<div class="product thumbnail">
<div class="caption">
<span class="text-muted pull-right"><%= @product.pack_size %></span>
<h2>
<div class="product-name"><%= @product.name %></div>
<span class="pull-right">₹
<small class="product-price"><%= @product.price %></small>
</span>
</h2>
<hr/>
<!-- add to cart code begins -->
<%= form_for @conn, "/cart", [as: :cart], fn f -> %>
<%= hidden_input f, :product_id, value: @product.id %>
<%= number_input f, :quantity, value: 1 %>
<%= submit "Add to cart" %>
<% end %>
<!-- add to cart code ends -->
</div>
<img src="<%= @product.image %>" />
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment