Gomeza Posted November 7, 2007 Posted November 7, 2007 Hi Folks I believe what I am trying to accomplish can be done and may be useful to others. I am attempting to define a new class in my oscommerce stylesheet that controls the appearance of the What's New infobox only. As it sits now, all infoboxes are the same class in the stylesheet, making the appearance and text for Categories, Shopping Cart etc. and What's New all the same. I know enough to be dangerous when it comes to coding but think if someone could simply tell me which files need to be changed to do this, I can figure it out. I would then post the solution in a summarized form in this thread. Or if someone has already done this and posted the solution, that'd be even better. Any input is greatly appreciated.
digilee Posted November 7, 2007 Posted November 7, 2007 Create a class in the stylesheet and then reference it in the relevant box. Example: Stylesheet .newbox { colour:red;} newsidebox.php new newsidebox($info_box_contents); SolarFrenzy Solar powered gadgets at down to earth prices. CheekyNaughty Promoting British Design
Gomeza Posted November 7, 2007 Author Posted November 7, 2007 Hi digilee I appreciate your contribution but I have tried something like that already. I have the new class created in the stylesheet: .SideinfoBox2 { background: #00ff00; font-family: Verdana, Arial, sans-serif; font-size: 10px; font-weight: bold; And then I tried to add this line of code: new SideinfoBox2($info_box_contents); to the file whats_new.php ... which produced a fatal error saying the class does not exist. Would you mind being more specific about where these code snippets are placed? Thanx
usernamenone Posted November 7, 2007 Posted November 7, 2007 The file you need to make your changes in is products_new.php start with line 43
Gomeza Posted November 8, 2007 Author Posted November 8, 2007 The file you need to make your changes in is products_new.php start with line 43 Hi usernamenone I appreciate anyone taking the time to post a reply but what you are saying cannot possibly be correct. If I am wrong on this, I will humbly apologize but to my knowledge the products_new.php file's only relationship to the whats_new.php file is that it is called to list the new products when the image or link in the What's New box is clicked on.
usernamenone Posted November 8, 2007 Posted November 8, 2007 Sorry, of course it is includes > modules > new_products.php
digilee Posted November 8, 2007 Posted November 8, 2007 In the example above, you would change the code in catalogue/includes/boxes/newsidebox.php in newsidebox.php: new newsidebox($info_box_contents); SolarFrenzy Solar powered gadgets at down to earth prices. CheekyNaughty Promoting British Design
Gomeza Posted November 8, 2007 Author Posted November 8, 2007 Hi again digilee and usernamenone Far be it from me to be critical of anyone who attempts to help out in this type of forum but I feel you are both on the wrong track here. Again I am attempting to define separate classes for each of the individual sideboxes. The hierarchy to do this has to be: includes/classes/boxes.php - modify the class constructor includes/boxes/whats_new.php (etc.) - modify each appropriate sidebox file with a new class name catalogue/stylesheet.css - write the style attributes for each of the unique new class names I'll get this sorted out eventually and will post the solution
digilee Posted November 8, 2007 Posted November 8, 2007 Possibly I am not quite thinking along the same lines as you. If I understand correctly, you simply want to have 2 different styles in the side boxes (please correct me if I am wrong). I did this a while back by simple creating a class in the style sheet and the changing the relevant tags in the box file, as outlined above. This worked fine for me (in fact I eventually had 3 different styles!). I've just checked back through some old files and what I have is this: I wanted one box to have a standard colouring, and one to be all white. In the 2 boxes files (includes/boxes/categories.php and manufacturers.php) I have: 1 with - new sideBox($info_box_contents); and 1 with - new sidewhiteBox($info_box_contents); NOTE there are 2 instances of these in each file so you would change these lines: new sideBoxHeading($info_box_contents, false, false); and new sideBox($info_box_contents); to new sidewhiteBoxHeading($info_box_contents, false, false); new sidewhiteBox($info_box_contents); In the style sheet I simply created a new class: Original: .sideBoxHeading { background-color:#ff7ed8; width:140px; background-image:url(images/structure/title_bg.gif); font-size:96%; white-space: nowrap; font-weight:bold; color:#333; padding:5px; margin:0; } .sideBoxContents { background-image:url(images/structure/sidebar_top.gif); background-position:top; background-repeat:no-repeat; background-color:#ff7ed8; font-size:92%; padding:10px 3px 10px 3px; margin:0; } White box: .sidewhiteBoxHeading { width:140px; background: #fff; background-image:url(images/structure/title_bg.gif); background-repeat:repeat-x; font-size:96%; white-space: nowrap; font-weight:bold; color:#333; padding:5px; margin:0; } .sidewhiteBoxContents { background-image:url(images/structure/sidebar_white_top.gif); background-position:top; background-repeat:no-repeat; background-color:#fff; text-align:center; font-size:92%; padding:10px 5px 5px 5px; margin:0; border-bottom:dotted #dc519d 1px; border-left:dotted #dc519d 1px; border-right:dotted #dc519d 1px; } This worked for me. If it doesn't work for you then I have no idea, sorry. SolarFrenzy Solar powered gadgets at down to earth prices. CheekyNaughty Promoting British Design
Guest Posted November 9, 2007 Posted November 9, 2007 You could in whats_new.php change this : <!-- whats_new //--> <tr> <td> to : <!-- whats_new //--> <tr> <td class="myNewStyle"> Then in your stylesheet use the cascade to style each of the inner boxes : .myNewStyle { color : red; } .myNewStyle .infoBox { background : yellow; } .myNewStyle .infoBoxHeading { etc.. } .myNewStyle .infoBoxContents { etc.. } This would be easier than defining a new box class for each box you wanted styled differently but is not helped by the fact that osC uses so many nested tables.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.