osCommerce and osCMax shopping cart software forums

Shopping Cart Software

osCommerce with teeth!

 
 

Different background color for each category??

This is a discussion on Different background color for each category?? within the osCMax v1.7 Discussion forums, part of the osCMax v1.7 Forums category; I have 2 main categories and want to have a different background color for each and the same color for ...


Go Back   osCommerce and osCMax shopping cart software forums > osCMax v1.7 Forums > osCMax v1.7 Discussion

Register FAQ Members List Calendar Mark Forums Read


Free community membership! Fast easy FREE membership
Closed Thread

 

LinkBack Thread Tools
  #1  
Old 11-29-2004, 07:20 PM
New Member
 
Join Date: Jul 2004
Posts: 7
Thanks: 0
Thanked 2 Times in 2 Posts
Rep Power: 0
surfer
Default Different background color for each category??

I have 2 main categories and want to have a different background color for each and the same color for the products info.

I can change the background via the below but don't know how to have a seperate color for each category?? Any ideas??

catolg/template/css/stylesheet.css
TABLE.productListing {
background: #FFFFFF;
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Sponsored Links
Advertisement
  #2  
Old 12-04-2004, 09:14 PM
New Member
 
Join Date: Jul 2004
Posts: 7
Thanks: 0
Thanked 2 Times in 2 Posts
Rep Power: 0
surfer
Default How to do it.

Ok, fixed this one myself. Not sure if this is perfect but I'm learning as I go and it worked nicely.

The below changes make Oscommerce look at the Category ID and run the Stylesheet matching that Category ID. Eg: Category 3 will run Stylesheet3.css

File: catalog/templates/*your template*/main_page.tpl.php

Replace

Code:
<link rel="stylesheet" type="text/css" href="<?php echo DIR_WS_TEMPLATES; ?>stylesheet.css">
With

Code:
<link rel="stylesheet" type="text/css" href="<?php echo DIR_WS_TEMPLATES; ?>stylesheet<?php echo $stylesheet_number ?>.css">

File: catalog/includes/application_top

Replace

Code:
 if (tep_not_null($cPath)) {
   $cPath_array = tep_parse_category_path($cPath);
   $cPath = implode('_', $cPath_array);
   $current_category_id = $cPath_array[(sizeof($cPath_array)-1)];
 } else {
   $current_category_id = 0;
 }
With

Code:
 if (tep_not_null($cPath)) {
   $cPath_array = tep_parse_category_path($cPath);
   $cPath = implode('_', $cPath_array);
   $current_category_id = $cPath_array[(sizeof($cPath_array)-1)];
   $stylesheet_number = $current_category_id;
 } else {
   $current_category_id = 0;
   $stylesheet_number = '';
 }
Now Oscommerce will look for the Stylesheet that matchs the Category number. So you will need to create stylesheet1.css, stylesheet2.css etc in catalog/templates/*your template*/

Now you can edit each stylesheet.css file and have different category backgrounds, fonts etc.

There's probably a cleaner way to do this but I only have 3 categories so no biggy.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Sponsored Links
Advertisement
Closed Thread

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Changing Background color tclhost osCMax v2 Customization/Mods 2 11-05-2005 02:00 PM
Subcategory Background Color cathelle osCommerce 2.2 Modification Help 3 08-03-2005 09:10 AM
Changing Background Color of Header knowgangs osCMax v1.7 Discussion 2 07-12-2005 12:32 PM
where can I change the background color? chenzhu osCMax v2 Customization/Mods 1 06-30-2005 06:08 PM
How to change categories background color? javabeans osCMax v1.7 Discussion 1 04-19-2005 05:24 AM


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


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO
http://www.oscmax.com/forums/
Copyright 2008 osCMax