In the last content, we wrote the checkout processing. This time we will show the cart and order on a page so that users can easily see their shopping when they place an order.
1. Modify the checkout.rhtml file, just add a code:
<%= error_messages_for ("order")%>
<%= render_component (: Action => "Display_cart")%>―― this sentence
<%= Stylesheet_link_tag "Scaffold", "Depot": Media => "All"%>
Click on the "Checkout" link on the Display_cart page to see that the checkout page has changed, as shown in the figure:
2. But we see that in the top right of the page, the checkout link also shows that we certainly want to remove it. Back to the code added above:
<%= render_component (: Action => "Display_cart")%>
Render_component is actually putting the entire Display_cart page on display, and now we're going to add parameters so that it can be differentiated between the Display_cart page and the checkout page.
On the checkout page, change the code added above to read:
<%= render_component (: Action => "Display_cart",:p arams => {: Context =>: Checkout})%>
You can see that we have added a context parameter.