Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Featured Products Infobox Colour


Guest

Recommended Posts

Hi,

 

Does anyone know how to change the border colour of the Featured Products Infobox contrib. It's picking up the infobox class from stylesheet.css but I cant see which file calls the class.

 

This is the infobox class

 

.infoBox {

background: #705737;

}

 

It's also using infoboxcontents class to specify the contents colours etc.

 

.infoBoxContents {

background: #ffffff;

font-family: Verdana, Arial, sans-serif;

font-size: 10px;

color: #705737;

}

 

All other infoboxes are also using the infobox class to select the border colour.

 

I'm able to change the content colours etc. of all other infoboxes by creating a new class and specifing the new class in for example, the categories infobox (includes/boxes/categories.php).

 

I would like to create a new class to change the featured products infobox only, but which file would I alter to change the featured infobox from infobox class to my new class.

 

Hope I'm making sense.

 

Thanks

 

Adrian

Link to comment
Share on other sites

I believe that featured products uses the contents box class and the file would be includes/modules/featured_products.php or includes/modules/featured.php depending on which contribution was used as there are several

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

Hi Steve,

 

Thanks for the quick response.

 

I searched all the files that came with the featured products contrib but none contained any reference to the infobox or infoboxcontents classes. The featured infobox is definetly getting the border colour from the infobox class and the background colour and text size etc, from the infoboxcontents class.

 

But I cant understand how the featured infobox is calling these classes, cant see any reference in the contrib files.

 

Should I be looking in some other file.

 

Thanks

 

Adrian

 

 

 

Hi,

 

Does anyone know how to change the border colour of the Featured Products Infobox contrib.  It's picking up the infobox class from stylesheet.css but I cant see which file calls the class.

 

This is the infobox class

 

.infoBox {

  background: #705737;

}

 

It's also using infoboxcontents class to specify the contents colours etc.

 

.infoBoxContents {

  background: #ffffff;

  font-family: Verdana, Arial, sans-serif;

  font-size: 10px;

  color: #705737;

}

 

All other infoboxes are also using the infobox class to select the border colour.

 

I'm able to change the content colours etc. of all other infoboxes by creating a new class and specifing the new class in for example, the categories infobox (includes/boxes/categories.php).

 

I would like to create a new class to change the featured products infobox only, but which file would I alter to change the featured infobox from infobox class to my new class.

 

Hope I'm making sense.

 

Thanks

 

Adrian

Link to comment
Share on other sites

as I said previously without knowing which contribution it is, it is very hard to give an exact answer.

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

Hi,

 

This is the line in catalog/index.php that, I think calls the featured products module

 

<td><?php include(DIR_WS_MODULES . FILENAME_FEATURED); ?></td>

 

which links to the includes/modules/featured.php file.

 

There are no infobox or infoboxcontents classes specifed in this file.

 

There is a reference to $info_box_contents in featured.php. Is this an array, and if so what does it do. Where is $info_box_contents defined and would this be the place which calls the infobox classes.

 

Thanks

 

Adrian

Link to comment
Share on other sites

Try something along these lines

 

 

catalog/includes/classes/boxes.php

 

add this code:

 

//New content2Box Class
 class content2Box extends tableBox {
   function content2Box($contents) {
     $info_box_contents = array();
     $info_box_contents[] = array('text' => $this->content2BoxContents($contents));
     $this->table_cellpadding = '1';
     $this->table_parameters = 'class="content2Box"';
     $this->tableBox($info_box_contents, true);
   }

   function content2BoxContents($contents) {
     $this->table_cellpadding = '4';
     $this->table_parameters = 'class="content2BoxContents"';
     return $this->tableBox($contents);
   }
 }

 class content2BoxHeading extends tableBox {
   function content2BoxHeading($contents) {
     $this->table_width = '100%';
     $this->table_cellpadding = '0';

     $info_box_contents = array();
     $info_box_contents[] = array(array('params' => 'height="14" class="content2BoxHeading"',
                                        'text' => tep_image(DIR_WS_IMAGES . 'content2Box/corner_left.gif')),
                                  array('params' => 'height="14" class="content2BoxHeading" width="100%"',
                                        'text' => $contents[0]['text']),
                                  array('params' => 'height="14" class="content2BoxHeading"',
                                        'text' => tep_image(DIR_WS_IMAGES . 'content2Box/corner_right_left.gif')));

     $this->tableBox($info_box_contents, true);
   }
 }

 

 

catalog/includes/modules/features.php

 

change code to this

 

<?php
/*
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2002 osCommerce

 Released under the GNU General Public License
 
 Featured Products V1.1
 Displays a list of featured products, selected from admin
 For use as an Infobox instead of the "New Products" Infobox  
*/
?>
<!-- featured_products //-->
<?php
if(FEATURED_PRODUCTS_DISPLAY == 'true')
{
 $featured_products_category_id = $new_products_category_id;
 $cat_name_query = tep_db_query("select categories_name from categories_description where categories_id = '" . $featured_products_category_id . "' limit 1");
 $cat_name_fetch = tep_db_fetch_array($cat_name_query);
 $cat_name = $cat_name_fetch['categories_name'];
 $info_box_contents = array();

 if ( (!isset($featured_products_category_id)) || ($featured_products_category_id == '0') ) {
   $info_box_contents[] = array('align' => 'left', 'text' => '<a class="headerNavigation" href="' . tep_href_link(FILENAME_FEATURED_PRODUCTS) . '">' . TABLE_HEADING_FEATURED_PRODUCTS . '</a>');

 list($usec, $sec) = explode(' ', microtime());
 srand( (float) $sec + ((float) $usec * 100000) );
 $mtm= rand();

   $featured_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, s.status as specstat, s.specials_new_products_price, p.products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id left join " . TABLE_FEATURED . " f on p.products_id = f.products_id where p.products_status = '1' and f.status = '1' order by rand($mtm) DESC limit " . MAX_DISPLAY_FEATURED_PRODUCTS);
 } else {
   $info_box_contents[] = array('align' => 'left', 'text' => sprintf(TABLE_HEADING_FEATURED_PRODUCTS_CATEGORY, $cat_name));
   $featured_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, s.status as specstat, s.specials_new_products_price, p.products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c left join " . TABLE_FEATURED . " f on p.products_id = f.products_id where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . $featured_products_category_id . "' and p.products_status = '1' and f.status = '1' order by rand() DESC limit " . MAX_DISPLAY_FEATURED_PRODUCTS);
 }

 $row = 0;
 $col = 0; 
 $num = 0;
 while ($featured_products = tep_db_fetch_array($featured_products_query)) {
   $num ++; if ($num == 1) { new content2BoxHeading($info_box_contents); }
   $featured_products['products_name'] = tep_get_products_name($featured_products['products_id']);
   if($featured_products['specstat']) {
     $info_box_contents[$row][$col] = array('align' => 'center',
                                          'params' => 'class="smallText" width="33%" valign="top"',
                                          'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . $featured_products['products_name'] . '</a><br><s>' . $currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . 
                                          $currencies->display_price($featured_products['specials_new_products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . '</span>');
   } else {
     $info_box_contents[$row][$col] = array('align' => 'center',
                                          'params' => 'class="smallText" width="33%" valign="top"',
                                          'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . $featured_products['products_name'] . '</a><br>' . $currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])));
   }    
   $col ++;
   if ($col > 2) {
     $col = 0;
     $row ++;
   }
 }
 if($num) {
     
     new content2Box($info_box_contents);
 }
} else // If it's disabled, then include the original New Products box
{
  include (DIR_WS_MODULES . FILENAME_NEW_PRODUCTS);
}
?>
<!-- featured_products_eof //-->

 

catalog/stylesheet.css

 

add this

 

.content2Box {
 background: #b6b7cb;
}
TD.content2BoxHeading {
 font-family: Verdana, Arial, sans-serif;
 font-size: 10px;
 font-weight: bold;
 background: #bbc3d3;
 color: #ffffff;
}
.content2BoxContents {
 background: #f8f8f9; 
 color: #000000;
 font-family: Verdana, Arial, sans-serif;
 font-size: 10px;
}
A.content2BoxContents {
 font-family: Verdana, Arial, sans-serif;
 font-style: normal;
 font-weight: bold;
 font-size: 10px;
 color: #FFA500;
 text-decoration: none;
}
A.content2BoxContents:hover {
 font-family: Verdana, Arial, sans-serif;
 font-style: normal;
 font-weight: bold;
 font-size: 10px;
 color: #FFA500;
 text-decoration: none;
}

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

Steve, your a Star !!

 

Can't say enough how much I really love oscommerce and this community.

 

Code worked a treat. Just changed the left and right corner images from

 

DIR_WS_IMAGES . 'content2Box/corner_right_left.gif'

 

to

 

DIR_WS_IMAGES . 'infobox/corner_right_left.gif'

 

in boxes.php, as image found in infobox folder, I know this was a typo.

 

Also changed TD.content2BoxHeading class in stylesheet to include to have featured products header text in centre

 

text-align : center

 

Many thanks again Steve for your time, will hopefully be learning from you again !!

 

Go raibh M?le maith agat,

 

Adrian

 

 

 

 

Try something along these lines

catalog/includes/classes/boxes.php

 

add this code:

 

//New content2Box Class
?class content2Box extends tableBox {
? ?function content2Box($contents) {
? ? ?$info_box_contents = array();
? ? ?$info_box_contents[] = array('text' => $this->content2BoxContents($contents));
? ? ?$this->table_cellpadding = '1';
? ? ?$this->table_parameters = 'class="content2Box"';
? ? ?$this->tableBox($info_box_contents, true);
? ?}

? ?function content2BoxContents($contents) {
? ? ?$this->table_cellpadding = '4';
? ? ?$this->table_parameters = 'class="content2BoxContents"';
? ? ?return $this->tableBox($contents);
? ?}
?}

?class content2BoxHeading extends tableBox {
? ?function content2BoxHeading($contents) {
? ? ?$this->table_width = '100%';
? ? ?$this->table_cellpadding = '0';

? ? ?$info_box_contents = array();
? ? ?$info_box_contents[] = array(array('params' => 'height="14" class="content2BoxHeading"',
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'text' => tep_image(DIR_WS_IMAGES . 'content2Box/corner_left.gif')),
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? array('params' => 'height="14" class="content2BoxHeading" width="100%"',
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'text' => $contents[0]['text']),
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? array('params' => 'height="14" class="content2BoxHeading"',
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'text' => tep_image(DIR_WS_IMAGES . 'content2Box/corner_right_left.gif')));

? ? ?$this->tableBox($info_box_contents, true);
? ?}
?}

catalog/includes/modules/features.php

 

change code to this

 

<?php
/*
?osCommerce, Open Source E-Commerce Solutions
?http://www.oscommerce.com

?Copyright (c) 2002 osCommerce

?Released under the GNU General Public License
?
?Featured Products V1.1
?Displays a list of featured products, selected from admin
?For use as an Infobox instead of the "New Products" Infobox ?
*/
?>
<!-- featured_products //-->
<?php
if(FEATURED_PRODUCTS_DISPLAY == 'true')
{
?$featured_products_category_id = $new_products_category_id;
?$cat_name_query = tep_db_query("select categories_name from categories_description where categories_id = '" . $featured_products_category_id . "' limit 1");
?$cat_name_fetch = tep_db_fetch_array($cat_name_query);
?$cat_name = $cat_name_fetch['categories_name'];
?$info_box_contents = array();

?if ( (!isset($featured_products_category_id)) || ($featured_products_category_id == '0') ) {
? ?$info_box_contents[] = array('align' => 'left', 'text' => '<a class="headerNavigation" href="' . tep_href_link(FILENAME_FEATURED_PRODUCTS) . '">' . TABLE_HEADING_FEATURED_PRODUCTS . '</a>');

?list($usec, $sec) = explode(' ', microtime());
?srand( (float) $sec + ((float) $usec * 100000) );
?$mtm= rand();

? ?$featured_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, s.status as specstat, s.specials_new_products_price, p.products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id left join " . TABLE_FEATURED . " f on p.products_id = f.products_id where p.products_status = '1' and f.status = '1' order by rand($mtm) DESC limit " . MAX_DISPLAY_FEATURED_PRODUCTS);
?} else {
? ?$info_box_contents[] = array('align' => 'left', 'text' => sprintf(TABLE_HEADING_FEATURED_PRODUCTS_CATEGORY, $cat_name));
? ?$featured_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, s.status as specstat, s.specials_new_products_price, p.products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c left join " . TABLE_FEATURED . " f on p.products_id = f.products_id where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . $featured_products_category_id . "' and p.products_status = '1' and f.status = '1' order by rand() DESC limit " . MAX_DISPLAY_FEATURED_PRODUCTS);
?}

?$row = 0;
?$col = 0; 
?$num = 0;
?while ($featured_products = tep_db_fetch_array($featured_products_query)) {
? ?$num ++; if ($num == 1) { new content2BoxHeading($info_box_contents); }
? ?$featured_products['products_name'] = tep_get_products_name($featured_products['products_id']);
? ?if($featured_products['specstat']) {
? ? ?$info_box_contents[$row][$col] = array('align' => 'center',
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'params' => 'class="smallText" width="33%" valign="top"',
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . $featured_products['products_name'] . '</a><br><s>' . $currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . 
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? $currencies->display_price($featured_products['specials_new_products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . '</span>');
? ?} else {
? ? ?$info_box_contents[$row][$col] = array('align' => 'center',
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'params' => 'class="smallText" width="33%" valign="top"',
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . $featured_products['products_name'] . '</a><br>' . $currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])));
? ?} ? ?
? ?$col ++;
? ?if ($col > 2) {
? ? ?$col = 0;
? ? ?$row ++;
? ?}
?}
?if($num) {
? ? ?
? ? ?new content2Box($info_box_contents);
?}
} else // If it's disabled, then include the original New Products box
{
? include (DIR_WS_MODULES . FILENAME_NEW_PRODUCTS);
}
?>
<!-- featured_products_eof //-->

 

catalog/stylesheet.css

 

add this

 

.content2Box {
?background: #b6b7cb;
}
TD.content2BoxHeading {
?font-family: Verdana, Arial, sans-serif;
?font-size: 10px;
?font-weight: bold;
?background: #bbc3d3;
?color: #ffffff;
}
.content2BoxContents {
?background: #f8f8f9; 
?color: #000000;
?font-family: Verdana, Arial, sans-serif;
?font-size: 10px;
}
A.content2BoxContents {
?font-family: Verdana, Arial, sans-serif;
?font-style: normal;
?font-weight: bold;
?font-size: 10px;
?color: #FFA500;
?text-decoration: none;
}
A.content2BoxContents:hover {
?font-family: Verdana, Arial, sans-serif;
?font-style: normal;
?font-weight: bold;
?font-size: 10px;
?color: #FFA500;
?text-decoration: none;
}

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...