Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Turn on the light please!


gabi

Recommended Posts

I give up!It's messy.

I want to have for my site one bgcolor for boxes in left column and another bgcolor for new products tabel.

If I change bg in css infoBoxContents class I get the same bg for left boxes and new products too.

I dig in include/classes/boxes.php but I don't understand the logic for build the boxes.It seems like left column boxes and the main table in index.php use the same instance of the same class?!?..

It doesn't work if I set the bgcolor for tables in index.php(as wiki recomand ).

Could somebody turn on the light? :(

Link to comment
Share on other sites

You can use CSS to do this. <div id="leftColumn"> at the top of the file (in HTML context; you will need to echo it in PHP) and </div> at the end. Then just define a background color for that div in your stylesheet.css

 

Hth,

Matt

Link to comment
Share on other sites

Hi,

 

Put a class here:

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

 

like this:

<td class="colLeft" width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

 

Then setup a class in your stylesheet with that name.

 

Same for right column:

<!-- body_text_eof //-->

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- right_navigation //-->

 

Like this:

<!-- body_text_eof //-->

<td class="colRight" width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- right_navigation //-->

 

colRight and put that style in your stylesheet.

 

For the new products box you will need to make a new class...info is here:

http://wiki.oscommerce.com/helpHowtoChangeBoxManufacturer

 

It is for the manufacturer but it will work for the new products box.

 

Change the new products in catalog/includes/modules/new_products.php

 

Line 27

new newProductBox($info_box_contents);

and line 46

new newProductBox($info_box_contents);

 

I have this new box called newProductBox but you can name the class anything you want...make sure it is the same name as the new class you made in includes/classes/boxes.php.

Link to comment
Share on other sites

Uhh...Thank you very much.I got the idea.

But still remain the problem with left column.

So, I have to set the bgcolor for the content of left column boxes.They use for that the same class like all the boxes in the osc.

If I set in css bgcolor(class "colLeft" in td as you said) I only get the bgcolor for all col left area but not for boxes content(catalog,search,bla-bla...).

I think I have to define a class only for left col boxes use.Right? :rolleyes:

Link to comment
Share on other sites

If you use the div as above, then you can change the backgrounds of all the boxes in the left column by copying the .infoBox definitions and adding #leftColumn like so:

 

#leftColumn .infoBox {

 

Look here for an example of a stylesheet using this method (not an osCommerce site). The html is here.

 

Hth,

Matt

Link to comment
Share on other sites

Hi Matt,

I am not sure I understand...

Melinda idea is working so far and I set classes for the boxes I want to have a different bgcolor.

But I want to try your method too.

This boxes are generated dinamically with all the content.

My question is :where to put the div?In index file?

The content is in include/boxes/ ,the look and feel is in include/classes/boxes.php and css.The html is in index for example but here it doesn't make sense to put a div.The div has to be placed where the css class is picked so it has to be in boxes???I don't thing so.. :unsure:

Link to comment
Share on other sites

Matt,

 

I tried using the <div but I couldn't get it to work...probably my error.

 

Could you list the code and what it looks like and I would like to try it also.

 

As far as the content of the boxes those colors are set by these styles:

.infoBox

.infoBoxContents

TD.infoBoxHeading

Link to comment
Share on other sites

Hmm...the DIV doesn't seem to like being put inside the column. Possibly a conflict with the table layout? However, in includes/column_left.php, around lines 11-12, if I enclose the column in a tbody, it works (first and last line in original code):

*/
?>
<tbody id="colLeft">
<?php
 if ((USE_CACHE == 'true') && empty($SID)) {

and at the very end, after the ?>

</tbody>

With this added to stylesheet.css, immediately after the .infoBoxContents, the color is different (and ugly--you probably want to change this definition so the color is more appealing):

#colLeft .infoBoxContents {
 background: #333333;
 font-family: Verdana, Arial, sans-serif;
 font-size: 10px;
}

Note: you could also change the # to a . and use this with Melinda's solution. Then you don't have to add the tbody tags.

 

I prefer the tbody tags, because then you can just change the column_left.php file. Otherwise, you have to change the table tag on each page where you want this definition to apply (e.g. index.php, product_info.php, etc.).

 

Hth,

Matt

Link to comment
Share on other sites

Ok my friend.Your solution works as well and I don't have to make so many changes in the files.The bgcolor for the new products and so on.. can be changed in css .infoBox and the left col bg in whatever class set the tbody tag(this color is the border color for left col boxes too).

Thanks.I learned a lot about this topic.It's amazing how you share knowledge with others. :)

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...

Archived

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

×
×
  • Create New...