Adding query to header

Wanting to add a count of items in the users shopping cart in the header. Looks like this is the user had 3 items in the cart:
Shopping Cart (3)
I want to populate the (3) with the a method in the "Cart_model"
I put this code in the _blocks/header.php file
$this->load->model('Cart_model');
$this->load->library('session');
$cartItems = $this->Cart_model->countItemsInCart($cartId);

It throws an error:
Severity: Notice

Message: Undefined property: MY_Loader::$Cart_model

Filename: _blocks/header.php

What's the way to get around this?

Comments

Sign In or Register to comment.