Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Changing the background color based on Category

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 07-15-2010, 06:46 AM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

Default Changing the background color based on Category

For example in my Product List we have male and female puppies.
http://littlepuppiesonline.msidesigns.com/All-Little-Puppies/

I'm not hung up on it, but it would be great to be able to change the background color of each dogs listing based on their member ship to the Male or Female Category. Cat 10 for Male and 8 for Female?

Is this possible to set it up in the template as well as the Css?
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
  #2  
Old 07-15-2010, 12:08 PM
 
Shamun Shamun is offline
 

X-Adept
  
Join Date: Jun 2009
Location: North Carolina
Posts: 841
 

Default Re: Changing the background color based on Category

Find the background div and the proper variable and do something like:

{if $cat eq '10'}
<div id="special div for males">
{elseif $cat eq '8'}
<div id="special div for females">
{else}
<div id="standard div for the rest of the website">
{/if}
__________________
- Shane Munroe
Reply With Quote
  #3  
Old 07-15-2010, 12:21 PM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

Default Re: Changing the background color based on Category

Thanks Tal. I figured it was something like that.

Thank question was a 2 part question, because I don't know the background variable.

Actually I think I just need to modify the background to the Table to a Transparent Pink or Blue. Dang if I know how to do that...
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
  #4  
Old 07-15-2010, 01:05 PM
 
Shamun Shamun is offline
 

X-Adept
  
Join Date: Jun 2009
Location: North Carolina
Posts: 841
 

Default Re: Changing the background color based on Category

The variable for the category number.
I have no idea right now if its $cat.id or $cat.num or $cat or whatever. There is no variable for background color.
__________________
- Shane Munroe
Reply With Quote
  #5  
Old 07-15-2010, 07:21 PM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

Default Re: Changing the background color based on Category

Back ground color goes in the ul.bestsellers-products-item

ul.bestsellers-products-item-m li {
margin: 10px 0px 10px 0px;
list-style: none;
background-color:#b0c4de;
border-color:#f06300;
border-style:solid;
border-width:3px 2px;
padding: 0px;

I'm not positive about the $cat stuff either, I'll keep looking.
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
  #6  
Old 07-16-2010, 12:33 AM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default Re: Changing the background color based on Category

Ok so in your .tpl you will find class="bestsellers-products-item-m"

this controls the background color.

you need to code the tpl to change this class based on category.

so in your .tpl you would have

{if $cat eq '8'}
class="bestsellers-products-item-m-blue"
{elseif $cat eq '10'}
class="bestsellers-products-item-m-pink"
{else}
class="bestsellers-products-item-m"
{/if}

then create appropriate class in your CSS
__________________
xcart 5.1.2
Reply With Quote
  #7  
Old 07-16-2010, 04:33 AM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

Default Re: Changing the background color based on Category

ARW,

Yup, already did that. Except the "-m" represents male in my css and "-f" female.

The code in the bestsellers.tpl that sets that class is:

Code:
{if $bestsellers} {capture name=bestsellers} <ul class="bestsellers-products-item-m"> {foreach from=$bestsellers item=bestseller} <li>

Do I build the {if} formula inside the "<ul>" ?

I tried the following and that did work to well.
{if $cat eq '8'}
<ul class="bestsellers-products-item-m">
{elseif $cat eq '10'}
<ul class="bestsellers-products-item-f">
{else}
<ul class="bestsellers-products-item">
{/if}

It messed it up like it didn't have a Class at all.
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
  #8  
Old 07-16-2010, 08:18 AM
 
Shamun Shamun is offline
 

X-Adept
  
Join Date: Jun 2009
Location: North Carolina
Posts: 841
 

Default Re: Changing the background color based on Category

Code:
{if $bestsellers} {capture name=bestsellers} {if $cat eq '8'} <ul class="bestsellers-products-item-m"> {elseif $cat eq '10'} <ul class="bestsellers-products-item-f"> {else} <ul class="bestsellers-products-item"> {/if} {foreach from=$bestsellers item=bestseller} <li>

try that.
__________________
- Shane Munroe
Reply With Quote
  #9  
Old 07-16-2010, 09:20 AM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default Re: Changing the background color based on Category

tals version should work fine
__________________
xcart 5.1.2
Reply With Quote
  #10  
Old 07-16-2010, 06:12 PM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

Default Re: Changing the background color based on Category

Alright I will this weekend. If I can't nail this, I think I'll get paid
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 12:03 PM.

   

 
X-Cart forums © 2001-2020