I've installed all the examples of the book up to page 112 (Adding Products to a Shopping Cart).
Now, when I click Add to Cart I get the following errors:
--------------------------------------
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Welcome::$MOrders
Filename: controllers/welcome.php
Line Number: 69
Fatal error: Call to a member function updateCart() on a non-object in C:\Programs\xampp\htdocs\CI-CLAUDIA\system\application\controllers\welcome.php on line 69
---------------------------------------

Here is my welcome.php:
Code:
<?php
class Welcome extends Controller {
function __construct(){
parent::Controller();
}
function index()
{
$data['title'] = "Welcome to Claudia's Kids";
$data['navlist'] = $this->MCats->getCategoriesNav();
$data['mainf'] = $this->MProducts->getMainFeature();
$skip = $data['mainf']['id'];
$data['sidef'] = $this->MProducts->getRandomProducts(3,$skip);
$data['main'] = 'home';
$this->load->vars($data);
$this->load->view('template');
}
function cat($id)
{
$cat = $this->MCats->getCategory($id);
if (!count($cat)){
redirect('welcome/index','refresh');
}
$data['title'] = "Claudia's Kids | ". $cat['name'];
if ($cat['parentid'] < 1){
$data['listing'] = $this->MCats->getSubCategories($id);
$data['level'] = 1;
} else {
$data['listing'] = $this->MProducts->getProductsByCategory($id);
$data['level'] = 2;
}
$data['category'] = $cat;
$data['main'] = 'category';
$data['navlist'] = $this->MCats->getCategoriesNav();
$this->load->vars($data);
$this->load->view('template');
}
function subcat()
{
}
function product($id)
{
$product = $this->MProducts->getProduct($id);
if (!count($product)) {
redirect('welcome/index','refresh');
}
$data['grouplist'] = $this->MProducts->getProductsByGroup(3,$product['grouping'],$id);
$data['product'] = $product;
$data['title'] = "Claudia's Kids | ".$product['name'];
$data['main'] = 'product';
$data['navlist'] = $this->MCats->getCategoriesNav();
$this->load->vars($data);
$this->load->view('template');
}
function cart($productid=0){
if ($productid > 0) {
$fullproduct = $this->MProducts->getProduct($productid);
$this->MOrders->updateCart($productid,$fullproduct);
redirect('welcome/product/'.$productid, 'refresh');
} else {
$data['title'] = "Claudia's Kids | Shopping Cart";
if (count($_SESSION['cart'])){
$data['main'] = '';
$data['navlist'] = $this->MCats->getCategoriesNav();
$this->load->vars($data);
$this->load->view('template');
}else{
redirect('welcome/index','refresh');
}
}
}
function search()
{
if ($this->input->post('term')) {
$data['results'] = $this->MProducts->search($this->input->post('term'));
} else {
redirect('welcome/index','refresh');
}
$data['title'] = "Claudia's Kids | Search Results";
$data['main'] = 'search';
$data['navlist'] = $this->MCats->getCategoriesNav();
$this->load->vars($data);
$this->load->view('template');
}
function about_us()
{
}
function contact()
{
}
function privacy()
{
}
}
?>
Could anyone please tell me how to fix this problem?
Thanks for your help.