♥toyicebear Posted August 9, 2004 Posted August 9, 2004 Hei.... I am currently working on a project which requires the color scheme to change according to category. Since i am no php wiz... , i am hoping there is someone out there who can point me in the right direction..... For instance would a simple if, else statement related to category id work? or would it require making a separat function which is called according to category? Any input is appriciated..... Basics for osC 2.2 Design - Basics for Design V2.3+ - Seo & Sef Url's - Meta Tags for Your osC Shop - Steps to prevent Fraud... - MS3 and Team News... - SEO, Meta Tags, SEF Urls and osCommerce - Commercial Support Inquiries - OSC 2.3+ How To To see what more i can do for you check out my profile [click here]
Jan Zonjee Posted August 9, 2004 Posted August 9, 2004 For instance would a simple if, else statement related to category id work? I guess that could work, if you load a different stylesheet.css for that category or overrule the css stylesheet with <style> </style> in the head section. Depending on the category id you could do an include of a file from (e.g.) a separate subdirectory in (e.g.) includes. This would be triggered by the $_GET['cPath'] variable. If it is set and there is an include for that category (which you could name style_1_2.inc.php for the style sheet for category 1_2 for example) it includes that file (which would start with <style> .subHeading { styles that are different } </style> ) and if it not there wouldn't be included anything. Just what I would try, but there might be much easier solutions where I haven't thought of....
soccercheese Posted August 20, 2004 Posted August 20, 2004 I bookmarked this thread which talks about doing this. Haven't tried it myself though... http://www.oscommerce.com/forums/index.php?showtopic=49436&st=0
reliablesol Posted August 21, 2004 Posted August 21, 2004 I have done this in my project as the requirement were for the product heading text to be different colours according to categories as well as the table backgrounds. I will include a segment of code below. Near the top of catalog/product_info.php I have this segment of code; switch ($cPath){ case 21: $myClass = "Steel"; break; case 22: $myClass = "Brass"; break; case 23: $myClass = "Stainless"; break; case 24: $myClass = "Silicon"; break; default: $myClass = ""; } Note: if you don't use master products, this could be inserted into catalog/includes/modules/product_listing.php. I use master products contribution so in my catalog/includes/modules/master_listing.php I have the code below starting at line 114. Note the use of the $myClass variable; if ( ($column_list[$col] != 'MASTER_LIST_BUY_NOW') && ($column_list[$col] != 'MASTER_LIST_IMAGE' && ($column_list[$col] != 'MASTER_LIST_MULTIPLE' && ($column_list[$col] != 'MASTER_LIST_DESCRIPTION'))) ) { $lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text); } $list_box_contents[0][] = array('align' => $lc_align, 'params' => 'class="productListing'.$myClass.'-heading"', 'text' => $lc_text); } if ($listing_split->number_of_rows > 0) { $rows = 0; $master_query = tep_db_query($listing_split->sql_query); while ($listing = tep_db_fetch_array($master_query)) { $rows++; if (($rows/2) == floor($rows/2)) { $list_box_contents[] = array('params' => 'class="productListing'.$myClass.'-even"'); } else { $list_box_contents[] = array('params' => 'class="productListing'.$myClass.'-odd"'); } Then in stylesheet.css, I have duplicated the productListing-heading, productListing-odd and productListing-even classes for each category as shown below with the 'steel' example; TD.pageHeadingSteel { font-family: Verdana, Arial, sans-serif; font-size: 20px; font-weight: bold; color: #006632; } .productListingSteel-heading { font-family: Verdana, Arial, sans-serif; font-size: 10px; background: #efefe7; color: #006632; font-weight: bold; } TR.productListingSteel-odd { background: #efefe7; } TR.productListingSteel-even { background: #efefe7; } While I would like to post the URL to show you the working sample, it is a dealer only site and therefore not appropriate for general publication. Kerry Slavin
♥toyicebear Posted November 21, 2006 Author Posted November 21, 2006 Going through some of my old treads, and posting possible solutions for others to enjoy :D Great categories with different colors 1.0 Basics for osC 2.2 Design - Basics for Design V2.3+ - Seo & Sef Url's - Meta Tags for Your osC Shop - Steps to prevent Fraud... - MS3 and Team News... - SEO, Meta Tags, SEF Urls and osCommerce - Commercial Support Inquiries - OSC 2.3+ How To To see what more i can do for you check out my profile [click here]
Recommended Posts
Archived
This topic is now archived and is closed to further replies.