Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

different infoBoxHeading for different infoBox


joongpark

Recommended Posts

Posted

I know color for info box heading is set in stylesheet.css at infoBoxHeading

 

It's boring to have all infobox colors the same so I want to change them without using images.

 

I know that I should create more

infoBoxHeading classes but where do I go to implement them?

 

I can't do that in files at /inclues/boxes

my guess is at /inclues/class/boxes.php

 

Can some one let me know how to do this..I am sure many people can use this to make their shop look better.

 

Thanks.

Posted

I,m no clean programmer but this might be an answer.

It replaces the infoBox headers with gif files dependant on the box name

Firstly you will need to modify your boxes.php file found in the folder includesclasses.

 

find the following code around line 13

 

class tableBox {

   var $table_border = '0';

   var $table_width = '100%';

   var $table_cellspacing = '0';

   var $table_cellpadding = '2';

   var $table_parameters = '';

   var $table_row_parameters = '';

   var $table_data_parameters = '';

 

Replace with this

 

class tableBox {

   var $table_border = '0';

   var $table_width = '100%';

   var $table_cellspacing = '0';

   var $table_cellpadding = '2';

   var $table_parameters = '';

   var $table_row_parameters = '';

   var $table_data_parameters = '';

   var $heading_class = '';

 

next around line 100 find the code below:

 

class infoBoxHeading extends tableBox {

   function infoBoxHeading($contents, $left_corner = true, $right_corner = true, $right_arrow = false) {

     $this->table_cellpadding = '0';



     if ($left_corner) {

       $left_corner = tep_image(DIR_WS_IMAGES . 'infobox/corner_left.gif');

     } else {

       $left_corner = tep_image(DIR_WS_IMAGES . 'infobox/corner_right_left.gif');

     }

     if ($right_arrow) {

       $right_arrow = '<a href="' . $right_arrow . '">' . tep_image(DIR_WS_IMAGES . 'infobox/arrow_right.gif', ICON_ARROW_RIGHT) . '</a>';

     } else {

       $right_arrow = '';

     }

     if ($right_corner) {

       $right_corner = $right_arrow . tep_image(DIR_WS_IMAGES . 'infobox/corner_right.gif');

     } else {

       $right_corner = $right_arrow . tep_draw_separator('pixel_trans.gif', '11', '14');

     }



     $info_box_contents = array();

     $info_box_contents[] = array(array('params' => 'height="14" class="infoBoxHeading"', 'text' => $left_corner),

                                  array('params' => 'width="100%" height="14" class="infoBoxHeading"', 'text' => $contents[0]['text']),

                                  array('params' => 'height="14" class="infoBoxHeading" nowrap', 'text' => $right_corner));

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

   }

 }

 

Replace with this:

 

class infoBoxHeading extends tableBox {

   function infoBoxHeading($contents, $class, $left_corner = true, $right_corner = true, $right_arrow = false) {

     $this->table_cellpadding = '0';

     $this->heading_class = $class;



     if ($left_corner) {

       $left_corner =  tep_image(DIR_WS_IMAGES . 'infobox/' . $this->heading_class . '_left.gif');

     } else {

       $left_corner = tep_image(DIR_WS_IMAGES . 'infobox/' . $this->heading_class . '_right_left.gif');

     }

     if ($right_arrow) {

       $right_arrow = '<a href="' . $right_arrow . '">' . tep_image(DIR_WS_IMAGES . 'infobox/arrow_right.gif', ICON_ARROW_RIGHT) . '</a>';

     } else {

       $right_arrow = '';

     }

     if ($right_corner) {

       $right_corner = $right_arrow . tep_image(DIR_WS_IMAGES . 'infobox/' . $this->heading_class . '_right.gif');

     } else {

       $right_corner = $right_arrow . tep_draw_separator('pixel_trans.gif', '11', '14');

     }

     $info_box_contents = array();

     $info_box_contents[] = array(array('params' => 'background="images/infobox/' . $this->heading_class . '_background.gif" height="14" class="' . $this->heading_class . '"', 'text' => $left_corner),

                                  array('params' => 'background="images/infobox/' . $this->heading_class . '_background.gif" width="100%" height="14" class="' . $this->heading_class . '"', 'text' => $contents[0]['text']),

                                  array('params' => 'background="images/infobox/' . $this->heading_class . '_background.gif" height="14" class="' . $this->heading_class . '" nowrap', 'text' => $right_corner));

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

   }

 }

 

Save and close.

 

Now you will need to open the file folder includes/boxes and edit the following in every box you want to use I will use whats_new as an example:

 

Around line 21 find the following code:

 

    $info_box_contents = array();

   $info_box_contents[] = array('align' => 'left',

                                'text'  => BOX_HEADING_WHATS_NEW

                               );

   new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_PRODUCTS_NEW, '', 'NONSSL'));

 

replace with this:

 

  $info_box_contents = array();

 $info_box_contents[] = array('align' => 'left',

                              'text'  => BOX_HEADING_WHATS_NEW,

                             );

$class = 'whatsNew';

   new infoBoxHeading($info_box_contents, $class,  false, true, tep_href_link(FILENAME_PRODUCTS_NEW, '', 'NONSSL'));

 

Basically added the code in bold. Be careful not to overwrite the tep_href link as each one is uniqe to the box where applicable.

 

You will also need to switch on or off the corner gif using the true or false statments.

save and close.

 

Next you will need to make the following gif's a different set for each box.

 

whatsNew_background.gif

whatsNew_left.gif

whatsNew_right.gif

whatsNew_right_left

save them to the images/infobox folder.

 

Next I added a different class for each box to the stylesheet.css.

example.

.whatsNew { font-family: Verdana, Arial, sans-serif; font-size: 10px; color: #FFFFFF} for the whats_new.php file

.search { font-family: Haettenschweiler; font-size: 10px; background: #C6B6A5; color: #FFFFFF} for the search.php file

Posted

I am in the process of making each box independant of the next box for styles.

 

It is working on one site under development now and will before too long be available.

 

definition of before too long ... today ... tomorrow ... umm ... soon, I hope :)

 

This may come in handy, thanks lango

Archived

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

×
×
  • Create New...