Page 1 of 1
Sub-category thumbnail in Top Navigation
Posted: Wed Mar 27, 2013 9:14 am
by jepmaster
Hi all. So in an older version of Opencart I was able to customize my top navigation to display the sub-category thumbnails and the description. I've upgraded to the latest version and it's no longer working.
It's only returning:
[name] and [href]
How will I go about getting the thumbnail [image] link and [description] data?
Any help would be greatly appreciated!
Re: Sub-category thumbnail in Top Navigation
Posted: Wed Mar 27, 2013 10:15 am
by jepmaster
Nevermind. I found the solution.
For anyone wanting to put subcategory thumbnails in their top dropdown menu:
Modify:
catalog/controller/common/header.php
Change:
Code: Select all
$children_data[] = array(
'name' => $child['name'] . ($this->config->get('config_product_count') ? ' (' . $product_total . ')' : ''),
'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id']),
);
To:
Code: Select all
$children_data[] = array(
'name' => $child['name'] . ($this->config->get('config_product_count') ? ' (' . $product_total . ')' : ''),
'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id']),
'image' => $child['image'],
'description' => $child['description']
);
Save, then modify:
catalog/view/theme/default/template/common/header.tpl
and under the if(isset($category['children'][$i])), (under <div id="menu">) you can call the image as such:
Code: Select all
<img src="image/<?php echo $category['children'][$i]['image']; ?>" width="" />
Re: Sub-category thumbnail in Top Navigation
Posted: Mon Aug 31, 2015 9:57 pm
by Flysan
How to make it work on OC 2.0.2.0?
Re: Sub-category thumbnail in Top Navigation
Posted: Tue Sep 01, 2015 6:59 am
by IP_CAM
Good Idea!
For my OC V.1.5.6.5_rc, I had to use one of the existing default Lines in order to have Product Counting working.
Info and images here:
http://ipc.li/os/subcat_menu_image156.zip
Thank you!
Ernie
PS. Only works NICE with rather FEW Subcategories!
http://www.hitline.info/shop/
Re: Sub-category thumbnail in Top Navigation
Posted: Tue Sep 01, 2015 7:45 am
by IP_CAM
Flysan wrote:How to make it work on OC 2.0.2.0?
at best, by trail and error! See my file, in the ZIP, linked above, to compare the content with your v.2.x files, for similarities, and differences.
Good Luck
Ernie
PS: You'll possibly find something here as well:
http://www.opencart.com/index.php?route ... y%20Images