I want to add a image with a link on a specific category id but can't seem to work out how to do it in category.tpl file, below is what I have but nothing is showing on the category
<?php if($category_id=="1697") { ?>
<a href="#"><img alt="Seagate Barracuda SSD's" class="img-responsive" src="image/catalog/Seagate-Barracuda-SSDs.jpg" /></a>
<?php } ?>
I am using seo urls but thought as it's the category id, it would show or is there something I need to add into the catalog.php controller file?
Update: Just managed to solve it with the following code
In catalog/controller/product/catalog.php, added the following in
$data['category_id'] = $category_id;
In catalog/view/theme/default/product/catalog.tpl, I got the following
<?php if ($category_id == '1697') { ?>
<a href="#"><img alt="Seagate Barracuda SSD's" class="img-responsive" src="image/catalog/Seagate-Barracuda-SSDs.jpg" /></a>
<?php } ?>
First in the default OC in folder
catalog/view/theme/default/product
file catalog.tpl does not exist andcatalog.php
in the corresponding controller folder also does not exist.Maybe you want to retrieve in
catalog/view/theme/default/product/category.tpl
? So if you want to retrievecategory_id
incatalog/view/theme/default/product/category.tpl
you should:in
catalog/controller/product/category.php
find:belowe add:
Now you can in
catalog/view/theme/default/product/category.tpl
use your code: