<% if notice %>
    <p id="notice"><%= notice %></p>
<% end %>

<h1>Your Pragmatic Catalog</h1>
<% @products.each do |product| %>
    <div class="entry">
	<%= image_tag(product.image_url) %>
	<h3><%= product.title %></h3>
	<%= sanitize(product.description) %>
	<div class="price_line">
	    <span class="price"><%= number_to_currency(product.price) %></span>
	    <%= button_to "Add to Cart", line_items_path(:product_id => product) %>
	</div>
    </div>
<% end %>

<% if notice %>
    <p id="notice"><%= notice %></p>
<% end %>

<h1>Your Pragmatic Catalog</h1>
<% @products.each do |product| %>
    <div class="entry">
        <%= link_to(image_tag(product.image_url), 
                    line_items_path(:product_id => product.id),
                    html_options = {:method => :post}) %>
	<h3><%= product.title %></h3>
	<%= sanitize(product.description) %>
	<div class="price_line">
	    <span class="price"><%= number_to_currency(product.price) %></span>
	    <%= button_to "Add to Cart", line_items_path(:product_id => product) %>
	</div>
    </div>
<% end %>

Add to cart when click the link of the image
Add to cart when click the link of the image
