Showing the cart to our clients

This task is also very easy to accomplish with the new cart library. We will need a controller and a view. Just go to application/controllers/shop.php, and add a new function to it; show_cart would be a good name:

function show_cart()
{
$this->load->helper('form');
$this->load->view('cart');
}

Nothing much happening there, we only load the form helper and the cart view. We will do most of the work in application/views/cart.php:

<h1>This is our cart</h1> <?php //Open the form and point it to the update function echo form_open('shop/update'); ?> <table border="2"> <tr> <th>Product</th> <th>Quantity</th> <th style="text-align:right">Price</th> <th style="text-align:right">Total</th> </tr> <?php $i = 1; ?> <?php //Then ...

Get CodeIgniter 1.7 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.