Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

CSS style to control color scheme per category


Landho

Recommended Posts

I've been trying to figure out an approrpiate way to setup a CSS style that controlled the color scheme of each category...

 

Using the category id, and creating a style with that ID and the parameters... sounds pretty simple, but has been daunting me.

 

Looking for pretty basic stuff - just the row for the product name in product_info.php

 

Maybe will try to format the menu in the future - but for now just shooting for the basic look on the product_info.php page.

 

Anyone have any tips or contributions which may provide this ability?

Link to comment
Share on other sites

I've been trying to figure out an approrpiate way to setup a CSS style that controlled the color scheme of each category...

 

Using the category id, and creating a style with that ID and the parameters... sounds pretty simple, but has been daunting me.

 

Looking for pretty basic stuff - just the row for the product name in product_info.php

 

Maybe will try to format the menu in the future - but for now just shooting for the basic look on the product_info.php page.

 

Anyone have any tips or contributions which may provide this ability?

 

If I am not mistaken, Product name and Price in product_info.php are controlled by the PageHeading Class in your CSS.

Link to comment
Share on other sites

I'm not the best with this stuff but I'm working on this at the minute...its not elegant but it works.

 

<link rel="stylesheet" type="text/css" href="stylesheet.css" />
<?php if (isset($_GET['cPath'])) {
$catno= explode("_", $_GET['cPath']);
$catno= $catno[0];
echo "	<link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet".$catno.".css\" />\n"; }?>

 

First part loads the original stylesheet, with default colours etc for index page, information etc

Second gets the category id then writes a second stylesheet call.

The second stylesheet contains only the changes to the original for a particular category (mine is only 4 lines)

You'll need one for each category in the form of stylesheet1.css, stylesheet2.css etc....whatever your cat numbers are

 

 

...i wholeheartedly welcome better solutions

Link to comment
Share on other sites

<link rel="stylesheet" type="text/css" href="stylesheet.css" />
<?php 
if (isset($current_category_id)) echo '<link rel="stylesheet" type="text/css" href="stylesheet', $current_category_id, '.css" />'; ?>

 

Off the top of my head so might not work. But $current_category_id gets the ID of the current category you are looking at...

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...