diff --git a/app/views/carts/show.html.erb b/app/views/carts/show.html.erb index 91951df76d..a49ac1cc26 100644 --- a/app/views/carts/show.html.erb +++ b/app/views/carts/show.html.erb @@ -17,7 +17,7 @@ <% @cart_total = 0 %> <% cart.each do |product_id, details| %> - <%= render 'item', product_id: product_id, details: details %> + <%= render 'itm', product_id: product_id, details: details %> <% end %> diff --git a/app/views/orders/_item.html.erb b/app/views/orders/_item.html.erb new file mode 100644 index 0000000000..fe1b1389ed --- /dev/null +++ b/app/views/orders/_item.html.erb @@ -0,0 +1,25 @@ +<% quantity = line_item.quantity %> + +<% if product = Product.find_by(id: line_item.product_id) %> + <% item_total = line_item.total_price %> + <% @cart_total += item_total %> + + + <%= image_tag product.image.tiny %> + + +

<%= product.name %>

+
+

<%= product.description %>

+ + + <%= product.price %> + + + <%= quantity %> + + + <%= item_total %> + + +<% end %> diff --git a/app/views/orders/show.html.erb b/app/views/orders/show.html.erb index 63658e6ac6..101d9eff59 100644 --- a/app/views/orders/show.html.erb +++ b/app/views/orders/show.html.erb @@ -4,8 +4,33 @@

Order #<%= @order.id %>

-
-

Thank you for your order!

+
+ + + + + + + + + + + <% @cart_total = 0 %> + <% @order.line_items.each do |line_item| %> + <%= render 'item', line_item: line_item %> + <% end %> + + + + + + + +
ProductUnit PriceQuantityPrice
+ TOTAL: + + <%= @cart_total %> +
<%= link_to "Continue Shopping", root_path, class: 'btn btn-lg btn-primary' %>