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 ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#1
| |||
| |||
| 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; |
| Sponsored Links | ||
| ||
|
#2
| |||
| |||
| 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"> 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;
}
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 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. |
| Sponsored Links | ||
| ||
| Thread Tools | |
| |
| ||||
| 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 |