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

Different colour scheme for main categories

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 10-04-2004, 05:05 AM
 
ian_fs ian_fs is offline
 

Advanced Member
  
Join Date: Apr 2004
Location: Norwich, UK
Posts: 86
 

Default Different colour scheme for main categories

I have seven main root categories:-

- Running
- Football
- Rugby
- Hockey
- Boxing
- Netball
- Specials

With in those I have subcategories, ranging from 6 to 30.

However, what I would like is to have a different colour scheme for each of those main categories mentioned above, so seven colour schemes. This I roughly know how to do:-

Create a copy of home.php and rename it running.php etc. And then link to the category in them:- running.php?cat=2 for example, however if you changed the category number you could show items from the football section within the running section.

Plus I would like the colour scheme to run through to product detail level. As this reverts to the homepage colour scheme.

So my question is, is it possible to create some small variable smarty script which will identify the main root category and then load the appropiate style sheet?

Example

if cat=1
show style 1.css
if cat=2
show style 2.css
elseif cat=3
show style 3.css

I know that it is only a basic example, with only three categories, but I have upto 60 categories in total, plus more will be created while we add future products on but with category disabled (so a possible 100+ categories).

Basically a modification which would recognise the main root category eg. running and then select the style for that category and all subcategory's and detailed product views within that main category.

And I also have a deadline of end of October, so if this would take a while to do please tell me and I will put this idea on the back burner. But it would be nice if it was possible to do.[/list]
__________________
X-Cart 4.0.17
Reply With Quote
  #2  
Old 10-04-2004, 07:24 AM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default

use the variable from the location.tpl

something like

Code:
{if location[1].1 eq whatever} style.css {elseif location ......

check location.tpl for better idea of code
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
  #3  
Old 10-04-2004, 07:41 AM
 
ian_fs ian_fs is offline
 

Advanced Member
  
Join Date: Apr 2004
Location: Norwich, UK
Posts: 86
 

Default

I am afraid I do not understand the position or location part:-

if location[1].1

what do the [1].1

or in this example:-

$location[position].0

[position].0

mean?

Are they refering to root level and in this case [1].1 category one, subcategory one?
__________________
X-Cart 4.0.17
Reply With Quote
  #4  
Old 10-04-2004, 08:59 AM
 
ian_fs ian_fs is offline
 

Advanced Member
  
Join Date: Apr 2004
Location: Norwich, UK
Posts: 86
 

Default

I have been playing around and come up with a few things which work but dont do what I want.

Still I starting to understand.

eg

Code:
{if ( $cat < 1 or $cat > 3 )} <link rel="stylesheet" href="{$SkinDir}/{#CSSFile#}"> {/if}

If $cat is less than category one or more than category three; show the css file.

However in some of my categories I have subcategories like this:-

+ Running (cat 1) --[the main category]--
- Running Shoes (cat
- Clothing (cat 9)
- Accessories (cat 21)

Now how could I say that if category 1 show css file 1, and apply this to all the subcategories. Since I said in my previous post I do not understand $location[1].1 or $location[position].1

I know this is possible to do now, I am just finding it slightly frustrating, plus also learning this I have also realised the full potential of X-Cart through using Smarty.
__________________
X-Cart 4.0.17
Reply With Quote
  #5  
Old 10-04-2004, 12:55 PM
 
ian_fs ian_fs is offline
 

Advanced Member
  
Join Date: Apr 2004
Location: Norwich, UK
Posts: 86
 

Default

Well I am going round in huge circles here, I believe I have worked out what position and the location things do. And they dont do what I want.

The moethod you suggested more or less means I will need about 100 or more of these:-

if $cat eq "2" or $cat "3" bla bla

I cannot get it to recognise the root category of a product or a subcategory, may be what you suggested would do this but I just cannot figure it out. Surely it must be possible with that location variable to say select the second category to use that for the style, but I cannot get it to do that.

I did manage (messed around with the categories thing) to do location[1].2 and so fourth so it selected the second or third or fourth location down and use that for the hyperlink of all the location variables. So obvioulsy you can select a location, but to apply that to change stylesheet seem terribly confusing to me. Plus you need to be able to distinguish between different root categories. Maybe that is what you meant by location[1].1 eq whatever but I am unsure what I am supposed to put instead of the whatever. I have tried many things, managing to break x-cart and confuse it completely.

A nice example explaining how location[1].1 etc works would be good.

I am now confused and feeling far more ill than when I started,

And if anyone reads this will probably think I am bonkers more or less talking in a thread to myself.
__________________
X-Cart 4.0.17
Reply With Quote
  #6  
Old 10-04-2004, 02:00 PM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default

you will only need as many options as root categories you have.

if you edit smarty.php, look for

Code:
$smarty->debug_tpl="file:debug_templates.tpl";

change to

Code:
$smarty->debug_tpl="file:debug.tpl";

if you switch on the debug menu now youll see a full list of variables which should explain things better
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
  #7  
Old 10-04-2004, 02:34 PM
 
ian_fs ian_fs is offline
 

Advanced Member
  
Join Date: Apr 2004
Location: Norwich, UK
Posts: 86
 

Default

The debug console works in the admin view, but since I have modified the customer side, it does not appear. So I am thinking that I will have to go through my changes to get the debug console to work.
__________________
X-Cart 4.0.17
Reply With Quote
  #8  
Old 03-28-2005, 11:29 PM
  Jonathan501's Avatar 
Jonathan501 Jonathan501 is offline
 

Advanced Member
  
Join Date: Nov 2004
Posts: 44
 

Default

Did this work? I would like to do this on my site too.

Ex.
CD - Red
Hip Hop - Red
Rock - Red

DVD - Blue
Hip Hop - Blue
Rock - Blue

VHS - Orange
Hip Hop - Orange
Rock - Orange

Everything else gets some default color.
__________________
X-Cart Gold 4.0.12
X-AOM
Color Coded Order Status
Easy CheckOut
ezUpsell
Multiple Upselling Links
Order Management Made Easy
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 02:26 AM.

   

 
X-Cart forums © 2001-2020