Jump to content

[SOLVED] Different color for each category background


Recommended Posts

Hi mates! First of all, sorry if this topic was covered before. I've been searching here but didn't find anything that works for me.

I'm new into prestashop, and I'd like to know how to change the categories menu, making each category have its own background color. Not the background of the entire website, just the background of the row that contains the name of the category in the left menu.

You can take a look at www.ortosan.es to see what I'm talking about.

I'm using prestashop 1.5.4.1


Thanks so much

Link to comment
Share on other sites

okay, thanks for clarification. in this case you have to edit two things.

 

#1

template file of the category block: modules/blockcategories/category-tree-branch.tpl

you've got there:

<li {if isset($last) && $last == 'true'}class="last"{/if}>

change it to:

<li {if isset($last) && $last == 'true'}class="last blockcategoryitem_$node.id"{/if}>

 

then each element in the block categories will have own class:

  • blockcategoryitem_1
  • blockcategoryitem_2
  • blockcategoryitem_6
  • etc..

#2

then in the global.css style you will be able to create styles like:

.blockcategoryitem_1{

background:red;

color:white;

}

 

or any other styles you want

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
  • 5 months later...

Hi I do whit different img every category list. But I want img start 50px before category in left position. 

I want someting like this:

 

        ...............category1...

.......................category2...

   ....................categpry3...

      .................category4...

 

 

I try to put img in post but i can't 0.o

Edited by sikera (see edit history)
Link to comment
Share on other sites

Hi I do whit different img every category list. But I want img start 50px before category in left position. 

I want someting like this:

 

        ...............category1...

.......................category2...

   ....................categpry3...

      .................category4...

 

 

I try to put img in post but i can't 0.o

hello

 

i replied in your original topic, if is possible, please continue discussion there: http://www.prestashop.com/forums/topic/309273-css-how-background-category-start-before-them

 

Link to comment
Share on other sites

  • 2 years later...

Hello,

 

All apologizes for my english !

 

I am sorry to exhume the topic but my code doesn't look like the quoted one. I don't understand where i can get the class.

 

Can someone help with this :

{if $blockCategTree && $blockCategTree.children|@count}
<!-- Block categories module -->
<div id="categories_block_left" class="block">
	<!--<h2 class="title_block">
		{if isset($currentCategory)}
			{$currentCategory->name|escape}
		{else}
			{l s='Categories' mod='blockcategories'}
		{/if}
	</h2>-->
	<div class="block_content">
		<!--<ul class="tree {if $isDhtml}dhtml{/if}">-->
		<ul>
			{foreach from=$blockCategTree.children item=child name=blockCategTree}
				{if $smarty.foreach.blockCategTree.last}
					{include file="$branche_tpl_path" node=$child last='true'}
				{else}
					{include file="$branche_tpl_path" node=$child}
				{/if}
			{/foreach}
		</ul>
		{$blockCategTree|print_r}
	</div>
</div>
<!-- /Block categories module -->
{/if}

Thanks in advance !

Edited by cynthia1301 (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...