开发者

opencart how to display all categories with images on home page opencart 1.5.1.3

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜