We're going to create only one controller in this project, which is /path/to/codeigniter/application/controllers/shop.php
.
Let's go over that controller now, look at the code, and discuss how it functions.
Create the /path/to/codeigniter/application/controllers/shop.php
file and add the following code to it:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); class Shop extends MY_Controller { function __construct() { parent::__construct(); $this->load->library('cart'); $this->load->helper('form'); $this->load->helper('url'); $this->load->helper('security'); $this->load->model('Shop_model'); $this->load->library('form_validation'); $this->form_validation->set_error_delimiters('<div class="alert alert-danger">', '</div>'); } public function index() {
We want to display the correct products and as such, we need to test whether the user has clicked...