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.
Bookmarks