in opencart 1.5.1.3 i want to display all categories with images at top and category name at botoom.
once any one click on image or name will goto that category page.
i am trying my best, even i have featured.tpl file, which is showing featured products on home page, i also try to modify it but its not working.
in featured.tpl i try to change
<?php foreach ($products as $product) { ?>
to
<?php foreach ($categories as $category) { ?>
but this is not working and displaying error
Invalid argument supplied for foreach()
how can i display that?
Thanks
You can't just use $categories in the tpl file, you have to assign the categories to the view using the controller
Open
/catalog/controller/module/featured.php
Find this line around line 10
$this->load->model('catalog/product');
Before it put
$this->load->model('catalog/category');
$this->data['categories'] = $this->model_catalog_category->getCategories(0);
And save