mayid Posted January 11, 2011 Share Posted January 11, 2011 I would like to move the image category to the left column. So i look into the category.tpl file and i copy this lines, but nothing happens: {if $scenes} <!-- Scenes --> {include file=$tpl_dir./scenes.tpl scenes=$scenes} {else} <!-- Category image --> {if $category->id_image} getCatImageLink($category->link_rewrite, $category->id_image, 'category')}" alt="{$category->name|escape:'htmlall':'UTF-8'}" title="{$category->name|escape:'htmlall':'UTF-8'}" id="categoryImage" /> {/if} {/if} It seems like this only evaluates in the center column, somehow. Is there any other technique to place the category image in the side bar? Link to comment Share on other sites More sharing options...
rocky Posted January 12, 2011 Share Posted January 12, 2011 It's not that easy. The $category object is only available in category.tpl, not the header.tpl template. If you want to add it to that template, you must add the following to header.php before the $smarty->display: if (isset($_GET['id_category'])) { $category = new Category(intval($_GET['id_category']), intval($cookie->id_lang)); if (Validate::isLoadedObject($category)) $smarty->assign('category', $category); } Then you can put the code before the {$HOOK_LEFT_COLUMN} in header.tpl. Link to comment Share on other sites More sharing options...
mayid Posted January 12, 2011 Author Share Posted January 12, 2011 Oh, thanks! That works. But i just had to modify this line so to use the original code:$smarty->assign('category',$category);However... the pic is tiny. I'll check why... Link to comment Share on other sites More sharing options...
rocky Posted January 13, 2011 Share Posted January 13, 2011 Thanks, I fixed my code above. Link to comment Share on other sites More sharing options...
Sandeep229 Posted February 3, 2012 Share Posted February 3, 2012 Hi rocky.. i want add images on the right & left hooks then what i do.. Or any module for this. Link to comment Share on other sites More sharing options...
morfer Posted February 11, 2012 Share Posted February 11, 2012 Hello, I just wanted to add the category image into the header.tpl. But with adding the lines rocky mentioned, it doesn't work for me! No output on the page?! Is the method still working with the actual version of the shop? Link to comment Share on other sites More sharing options...
mailojah Posted February 17, 2012 Share Posted February 17, 2012 Excuse me. This is my problem also! I want to set an image to each categories in the panel. Have you an example that I can study?? Link to comment Share on other sites More sharing options...
dhada Posted February 22, 2012 Share Posted February 22, 2012 This one might help you using jquery... {if $scenes} <!-- Scenes --> {include file="$tpl_dir./scenes.tpl" scenes=$scenes} {else} <!-- Category image --> {if $category->id_image} <script type="text/javascript"> $(document).ready(function(){ $('.catimage').prependTo($('#left_column')); }); </script> <div class="catimage"> <img src="{$link->getCatImageLink($category->link_rewrite, $category->id_image, 'category')}" alt="{$category->name|escape:'htmlall':'UTF-8'}" title="{$category->name|escape:'htmlall':'UTF-8'}" id="categoryImage" width="{$categorySize.width}" height="{$categorySize.height}" /> </div> {/if} {/if} Link to comment Share on other sites More sharing options...
mati06 Posted May 31, 2012 Share Posted May 31, 2012 Hi Also I wanted to have image of category in left column, but when i wrote script image doesn't appears. I use 1.4.4.1 version In file header.php i don't found $smarty->display, i have only $controller = new FrontController(); $controller->displayHeader(); So in header.php i have: if (isset($_GET['id_category'])) { $category = new Category(intval($_GET['id_category']), intval($cookie->id_lang)); if (Validate::isLoadedObject($category)) $smarty->assign('category', $category); } $controller = new FrontController(); $controller->displayHeader(); and in header.tpl i have {if $scenes} <!-- Scenes --> {include file="$tpl_dir./scenes.tpl" scenes=$scenes} {/if} <!-- Category image --> {if $category->id_image} <div class="align_center"> <img src="{$link->getCatImageLink($category->link_rewrite, $category->id_image, 'category')}" alt="{$category->name|escape:'htmlall':'UTF-8'}" title="{$category->name|escape:'htmlall':'UTF-8'}" id="categoryImage" width="{$categorySize.width}" height="{$categorySize.height}" /> </div> {/if} Could anyone help me? Thank you very much Link to comment Share on other sites More sharing options...
D-bird Posted September 16, 2013 Share Posted September 16, 2013 Feeling a bit stupid right now, but could someone explain step-by-step how to change the category images's position to left column? Link to comment Share on other sites More sharing options...
vekia Posted September 16, 2013 Share Posted September 16, 2013 you use prestashop 1.3 as author of this topic? Link to comment Share on other sites More sharing options...
D-bird Posted September 16, 2013 Share Posted September 16, 2013 I use presta 1.5.5 Link to comment Share on other sites More sharing options...
vekia Posted September 16, 2013 Share Posted September 16, 2013 so in this case try to move code: {if $scenes || $category->description || $category->id_image} <div class="content_scene_cat"> {if $scenes} <!-- Scenes --> {include file="$tpl_dir./scenes.tpl" scenes=$scenes} {else} <!-- Category image --> {if $category->id_image} <div class="align_center"> <img src="{$link->getCatImageLink($category->link_rewrite, $category->id_image, 'category_default')|escape:'html'}" alt="{$category->name|escape:'htmlall':'UTF-8'}" title="{$category->name|escape:'htmlall':'UTF-8'}" id="categoryImage" width="{$categorySize.width}" height="{$categorySize.height}" /> </div> {/if} {/if} {if $category->description} <div class="cat_desc"> {if strlen($category->description) > 120} <p id="category_description_short">{$category->description|truncate:120}</p> <p id="category_description_full" style="display:none">{$category->description}</p> <a href="#" onclick="$('#category_description_short').hide(); $('#category_description_full').show(); $(this).hide(); return false;" class="lnk_more">{l s='More'}</a> {else} <p>{$category->description}</p> {/if} </div> {/if} </div> {/if} from category.tpl to header.tpl right before the {$HOOK_LEFT_COLUMN}. i never tested it, but it is related to tutorial above (for 1.3) Link to comment Share on other sites More sharing options...
D-bird Posted September 16, 2013 Share Posted September 16, 2013 The magic happened. Thank you a lot! Link to comment Share on other sites More sharing options...
vekia Posted September 16, 2013 Share Posted September 16, 2013 glad to hear that i could help you a little special thanks to rocky - this is his solution best regards Link to comment Share on other sites More sharing options...
Recommended Posts