Answer the question
In order to leave comments, you need to log in
Opencart: How to display category images in the sidebar?
Good afternoon dear forum users!
I really need your help, because I do not understand where to go next.
In the standard module, it turns out without problems, but here the stopper ...
.../extension/module/category.tpl
Added to the right place:
<?php if ($category['image']) { ?>
<img src="<?php echo $category['image']; ?>"/>
<?php } else { ?>
<?php } ?>
$data['categories_tree']
if ($category['image']) {
$image = $this->model_tool_image->resize($category['image'], 20, 20);
} else {
$image = $this->model_tool_image->resize('placeholder.png', 20,20);
}
'image' => $image
$data['categories'][] = array(
if (isset($this->request->get['path'])) {
$parts = explode('_', (string)$this->request->get['path']);
} else {
$parts = array();
}
if(!empty($parts)){
$data['active'] = end($parts);
}else{
$data['active'] = 0;
}
$this->load->model('catalog/tree_cats');
$this->load->model('tool/image');
$data['categories'] = array();
$categories = $this->model_catalog_tree_cats->getTreeCats();
foreach($categories as $id => $category){
$categories[$id]['href'] = $this->url->link('product/category', 'path=' . $category['category_id']);
}
if ($category['image']) {
$image = $this->model_tool_image->resize($category['image'], 20, 20);
} else {
$image = $this->model_tool_image->resize('placeholder.png', 20,20);
}
$data['categories_tree'] = $this->model_catalog_tree_cats->getMapTree($categories);
return $this->load->view('extension/module/tree_cats', $data);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question