[eluser]ray73864[/eluser]
ok, so i have moved to a model for it, and done a couple of other things.
however the pagination still isn't working and i am not getting the links part. The new code is:
Controller Function:
Code:
function products($page = 0)
{
$this->load->model('productmodel');
$this->load->library('pagination');
$config['base_url'] = 'http://capelite.rayherring.net/admin_catalogue/products/';
$config['per_page'] = '10';
$config['total_rows'] = $this->productmodel->getProducts($config['per_page'],$page)->num_rows();
$this->pagination->initialize($config);
$data['links'] = $this->pagination->create_links();
$data['result'] = $this->productmodel->getProducts($config['per_page'],$page);
$data['categoryid'] = 0;
$this->load->view('header', $this->settings);
$this->load->view('shop_bar');
$this->load->view('menu');
$this->load->view($this->catalogue_folder . 'product/list', $data);
$this->load->view('footer');
}
Model Function:
Code:
function getProducts($num, $offset, $category = 0)
{
$this->db->select(' product.id AS product_id,
product.name AS product_name,
product.description AS product_description,
product_code,
category.id AS category_id,
category.name AS category_name');
$this->db->from('product');
$this->db->join('category','category.id = product.cat_id','left outer');
$this->db->where('product_code != ','');
$this->db->where('inactive',0);
if ($category)
{
$this->db->where('category.id',$category);
}
$this->db->limit($num, $offset);
$this->db->order_by('product_code','asc');
return $this->db->get();
}
The view hasn't changed