besssbesss Posted February 19, 2013 Share Posted February 19, 2013 (edited) Hi, I would like to get different style for each category i have on my website. I want to put a different background-color for the different categories i have. Here's my code: <li id="{if $id_category=32}category_32{elseif $id_category=33}category_33{elseif $id_category=34}category_34{/if}" {if isset($last) && $last == 'true'}class="last"{/if}> <a href="{$node.link|escape:'htmlall':'UTF-8'}" {if isset($currentCategoryId) && $node.id == $currentCategoryId}class="selected"{/if} title="{$node.desc|escape:'htmlall':'UTF-8'}">{$node.name|escape:'htmlall':'UTF-8'}</a> {if $node.children|@count > 0} <ul> {foreach from=$node.children item=child name=categoryTreeBranch} {if $smarty.foreach.categoryTreeBranch.last} {include file="$branche_tpl_path" node=$child last='true'} {else} {include file="$branche_tpl_path" node=$child last='false'} {/if} {/foreach} </ul> {/if} </li> With this code, I still have the category_32 generated for my three categories. Someone has an idea to help me please ? I'm triyng to solve that since few days now, i can't find a solution. Please help me. Thank you ! Edited February 19, 2013 by besssbesss (see edit history) Link to comment Share on other sites More sharing options...
PascalVG Posted February 19, 2013 Share Posted February 19, 2013 What happens is {if $Id_category=32} Doesn't compare, but ASSIGNS 32 to $id_category :-), returning a TRUE use == (Double =) to compare <li I'd="{if $id_category==32}... Hope this helps Pascal Link to comment Share on other sites More sharing options...
besssbesss Posted February 19, 2013 Author Share Posted February 19, 2013 Hi thank you for your answer. I just find another soluton here: http://www.prestashop.com/forums/topic/91515-two-block-categories/ to do what I wanted. I keep your solution for another time maybe. Thank you again Link to comment Share on other sites More sharing options...
PascalVG Posted February 19, 2013 Share Posted February 19, 2013 (edited) Hi besssssssss, I read the link you provided, but I don't think they provide an answer how to change the style, as you need, only how to create two/three different category blocks, each with their own contents. Probably still need to change the class or ID of each block. Edited February 19, 2013 by PascalVG (see edit history) Link to comment Share on other sites More sharing options...
besssbesss Posted February 19, 2013 Author Share Posted February 19, 2013 Hi Pascal, Yes i've duplicate the blockcategories folder. And in each php file of the folder, i put the id of the category i want. And then, in the tpl file, i've put the class i want for each category. And i create the different class in my css. I was looking for a solution for 3 days now, and it work very well with this one. Link to comment Share on other sites More sharing options...
PascalVG Posted February 19, 2013 Share Posted February 19, 2013 Good, Enjoy. Please mark your question as [sOLVED] (Edit your original question, press the full editor button, edit your header) Pascal 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