I am new to php, same with the opencart. I want to add image w/ link instead of the traditional list of links.
http://www.metroingeni.ro/aparatura/cantare-si-sisteme-de-cantarire
Example of where i want to implement.
I am new to php, same with the opencart. I want to add image w/ link instead of the traditional list of links.
http://www.metroingeni.ro/aparatura/cantare-si-sisteme-de-cantarire
Example of where i want to implement.
Ok, think I understand what you seek.
First you need to find a controller that is responsible for category view, you can find it (I assume it's OC2) in catalog/controller/product/category.php
file. Somewhere around line 160 you will see:
$data['categories'][] = array(
'name' => $result['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''),
'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url)
);
replace it with
$data['categories'][] = array(
'name' => $result['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''),
'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url),
'image'=> $result['image']
);
then in your category view, located at catalog/view/theme/default/template/product/category.tpl
somewhere around line 35 and 45, you can place the category image which we got from the controller earlier in a form like <?php echo $category['image']; ?>
.
<?php echo $category['image']; ?>
in your view category.tpl
is a relative URL of the image. Put it in your image source attribute. Must be within foreach loop of categories.
Hope this helps, I have not tested this code but it should work.
Default installation of opencart 2 is here assumed, but the concept should apply to any or most themes or extensions.