[eluser]feri_soft[/eluser]
I have a recursive function for getting all products in the cat and in its subcats and its working fine:
Code:
function getAllProducts($catID, $limit, $offset){
$query = $this->db->getwhere('products',array('category' => $catID), $limit, $offset);
if($query->num_rows() > 0){
foreach($query->result_array() as $product){
$this->products[] = $product;
}
}
if($this->getSubCats($catID)){
foreach ($this->getSubCats($catID) as $subcat) {
$this->getAllProducts($subcat['id'], $limit, $offset);
}
}
return $this->products;
}
Now i can put the total_results, the url and so on in the pagination config, but when i try to manipulate the limit and offset in this function i get errors.
Code:
$this->db->getAllproducts($cat_info['$id'], $config['per_page'], $this->uri->segment(3));
How am i supposed to change the function so that the correct articles are get. Now i get all on the first page and nothing on the rest...