[eluser]Martin Rusev[/eluser]
Hello everybody,
I am pretty new to php an Codeigniter. Right now i am writing my first real world application. From some time i am facing the following problem
I have this hierarchy:
main category -> subcategory -> product
Đ•very page has a breadcrumb - I load all the information and the breadcrumb information at the same time with the following :
Code:
// Loading Main category name from the database
$this->load->model('maincategories');
$data['main_category'] = $this->maincategories->get_maincategories_id($main_id);
//Loading Products
$this->load->model('productsmodel');
$products = $this->productsmodel->get_products($id);
//get_products returns array
Array
(
[0] => stdClass Object
(
[id] => 1
[subcategory_id] => 2
[article] => Article 1
[product_name] => Product Name 1
[product_thickness] => 12
[product_lenght] => 180
[product_weight] => 122
[product_price] => 230
)
[1] => stdClass Object
(
[id] => 5
[subcategory_id] => 2
[article] => Article 2
[product_name] => Product Name 2
[product_thickness] => 23
[product_lenght] => 23
[product_weight] => 23
[product_price] => 23
)
And finally i want to access subcategory_id from this array and pass it back to my model
for retrieving Subcategory name from another table in the database
Code:
$this->load->model('subcategoriesmodel');
$subcategory = $this->subcategoriesmodel->get_subcategory_name($subcategory_id);
thanks