Jump to content

Assigner une couleur à un menu


Recommended Posts

Bonjour l'équipe !! Je suis nouveau sur Prestashop.

J'utilise la version 1.5.3.1 et j'utilise un template acheté.

Je voudrais savoir comment faire dans mon menu pour assigner une couleur différente pour chaque catégorie ?

 

J'ai trouvé dans mon theme/tmon_emplate/modules/blockcategories un fichier category-tree-branch.tpl qui semble gérer mon menu.

Le code est :

<li {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="$tpl_dir./category-tree-branch.tpl" node=$child last='true'}
			{else}
				{include file="$tpl_dir./category-tree-branch.tpl" node=$child last='false'}
			{/if}
		{/foreach}
		</ul>
	{/if}
</li>

Par défaut, le menu à un background image dans mon css assigné sur toutes mes catégories.

merci pour votre aide !!

Link to comment
Share on other sites

Bien pour ceux que ça intéresse, je me suis aidé de cette aide pour arriver à mes fins ;)

 

So you want the Laptop category to have a different colour than the other categories? You'll need to change line 1 of modules/blockcategories/category-tree-branch.tpl from:
 

<li {if $last == 'true'}class="last"{/if}>

to:
 

<li class="cat{$node.id}{if $last == 'true'} last{/if}">

You will then be able to use code like the following to global.css to make just to the Laptop category red:
 

div#categories_block_left ul.tree li.cat4 a { color: red }
Edited by Julien Encre verte (see edit history)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...