Alter Box StylesLast Update: 10th August, 2005
Article ID: 263



Introduction

Some of the boxes can have a separate style than the other boxes by adding new styles to that box.

Manufacturer Box

An example of changing the manufacturer box would be to put a colored outline around the Manufacturer's drop down box only.

Create a new "box class" in catalog/includes/classes/boxes.php like:

class plainBox extends tableBox {
function plainBox($contents) {
$this->table_data_parameters = 'class="plainBox"';
$this->tableBox($contents, true);
}
}



Then in your stylesheet.css, define a new class called "plainBox" and assign the
settings you want for your newly positioned manufacturers box.

Then change your catalog/includes/boxes/manufacturers.php so that the last line goes from:

new infoBox($info_box_contents);
?>
</td>
</tr>
< !-- manufacturers_eof //-->



To this:

new plainBox($info_box_contents);
?>
</td>
</tr>
< !-- manufacturers_eof //-->



To move the manufacturers box code to a different location without the box the same class as above would be made and the <tr><td> </td></tr> tags would be removed:

<!-- manufacturers //-->
< ?php
/* $info_box_contents = array();
$info_box_contents[] = array('text' => BOX_HEADING_MANUFACTURERS);

new infoBoxHeading($info_box_contents, false, false); */

$manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name");
if (tep_db_num_rows($manufacturers_query) <= MAX_DISPLAY_MANUFACTURERS_IN_A_LIST) {
// Display a list
$manufacturers_list = '';
while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
$manufacturers_name = ((strlen($manufacturers['manufacturers_name']) > MAX_DISPLAY_MANUFACTURER_NAME_LEN) ? substr($manufacturers['manufacturers_name'], 0, MAX_DISPLAY_MANUFACTURER_NAME_LEN) . '..' : $manufacturers['manufacturers_name']);
if (isset($HTTP_GET_VARS['manufacturers_id']) && ($HTTP_GET_VARS['manufacturers_id'] == $manufacturers['manufacturers_id'])) $manufacturers_name = '<b>' . $manufacturers_name .'</b>';
$manufacturers_list .= '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturers['manufacturers_id']) . '">' . $manufacturers_name . '</a><br>';
}

$info_box_contents = array();
$info_box_contents[] = array('text' => substr($manufacturers_list, 0, -4));
} else {
// Display a drop-down
$manufacturers_array = array();
if (MAX_MANUFACTURERS_LIST < 2) {
$manufacturers_array[] = array('id' => '', 'text' => PULL_DOWN_DEFAULT);
}

while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
$manufacturers_name = ((strlen($manufacturers['manufacturers_name']) > MAX_DISPLAY_MANUFACTURER_NAME_LEN) ? substr($manufacturers['manufacturers_name'], 0, MAX_DISPLAY_MANUFACTURER_NAME_LEN) . '..' : $manufacturers['manufacturers_name']);
$manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'],
'text' => $manufacturers_name);
}

$info_box_contents = array();
$info_box_contents[] = array('form' => tep_draw_form('manufacturers', tep_href_link(FILENAME_DEFAULT, '', 'NONSSL', false), 'get'),
'text' => tep_draw_pull_down_menu('manufacturers_id', $manufacturers_array, $HTTP_GET_VARS['manufacturers_id'], 'onChange="this.form.submit();" size="' . MAX_MANUFACTURERS_LIST . '" style="width: 100%"') . tep_hide_session_id());
}

new plainBox($info_box_contents);
?>
< !-- manufacturers_eof //-->



This size will need to be changed depending on the size needed:

'onChange="this.form.submit();" size="' . MAX_MANUFACTURERS_LIST . '" style="width: 100%"') .


You can change this is a fixed value.

If you just want to remove the heading cell comment out these lines in the catalog/includes/boxes/manufacturers.php page like:

/* $info_box_contents = array();
$info_box_contents[] = array('align' => 'left',
'text' => BOX_HEADING_MANUFACTURERS);
new infoBoxHeading($info_box_contents, false, false); */



Search Box

The search code can be added to any page using this code:

< form name="quick_find" method="get" action="http://www.yoururl.com/advanced_search_result.php">
< input type="text" name="keywords" size="10" maxlength="30" value="" style="width: 95px">&nbsp;<input type="submit" value="go"><br>
< a href="http://www.yoururl.com/advanced_search.php"><b style="font-size:8pt;">Advanced Search</b></a>
< /form>



To remove the box take out the <tr><td> at the beginning and the </tr></td> tags toward the end in catalog/includes/boxes/search.php.

If you just want to remove the heading cell comment out these lines in catalog/includes/search.php

/*$info_box_contents = array();
$info_box_contents[] = array('align' => 'left',
'text' => BOX_HEADING_SEARCH
);
new infoBoxHeading($info_box_contents, false, false); */

 

 

Trademark Policy | Copyright Policy | Sitemap

Copyright © 2000-2005 osCommerce. All rights reserved.