Erida Posted April 14, 2010 Share Posted April 14, 2010 Hi,I want to display an image for each category in the menu (different images for different categories). I can't find a module that does this so I'm trying to solve this on my own. I'm trying to place an image link in categoriesbar module/category-bar-level.tpl that will pick up the category image. I've succeeded in getting the path to the image folder ( {$img_cat_dir} ) but how do I pick up the category image? I've tried yo use {$category->id_image} but it doesn't work...Thankful for a solution! Link to comment Share on other sites More sharing options...
ashian Posted June 15, 2011 Share Posted June 15, 2011 Hi,What version do you use in prestashop?I am using prestashop v 1.4.1. I display all categories on home page with their images. I success.This is the site that i builthttp://sourcing-in-vietnam.comAnd here my solutionIn modules/blockcategories/category-tree-branch.tpl, change this codegetCatImageLink($category->link_rewrite, $node.id, 'category')}"[/b] alt="{$category->name|escape:'htmlall':'UTF-8'}" title="{$category->name|escape:'htmlall':'UTF-8'}" id="categoryImage" width="{$categorySize.width}" height="{$categorySize.height}" />Hope this will help you. Link to comment Share on other sites More sharing options...
venkatesh Posted December 31, 2011 Share Posted December 31, 2011 Hi ashian, I changed like what u said. It wont give image. <img src="{$link->getCatImageLink($category->link_rewrite, $node.id, 'category')}" alt="{$category->name|escape:'htmlall':'UTF-8'}" title="{$category->name|escape:'htmlall':'UTF-8'}" id="categoryImage" /> any one help regarding this? Link to comment Share on other sites More sharing options...
PSD-to-Template Posted July 22, 2014 Share Posted July 22, 2014 {assign var="cat_img" value="$tpl_dir../../img/c/{$node.id}-categories_home.jpg"} {if file_exists($cat_img)} <img class="replace-2x" src="{$cat_img}" alt="" /> {else} <img class="replace-2x" src="/img/c/nl-default-categories_home.jpg" alt="" /> {/if} Hope it is clear This should work in 1.5 and 1.6 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now