November 2009
Beginner to intermediate
300 pages
5h 43m
English
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 ...Read now
Unlock full access