Guest Posted December 11, 2002 Posted December 11, 2002 Hi, does anybody know how to do this catagories styley box..as featured in this website.. http://www.dcpcwebdesign.co.uk/ Thanks :D [/url]
mattice Posted December 11, 2002 Posted December 11, 2002 http://www.dcpcwebdesign.co.uk/download/do...loadcatalog.zip should give you an idea :D "Politics is the art of preventing people from taking part in affairs which properly concern them"
Guest Posted December 11, 2002 Posted December 11, 2002 So, we just replace our "catalog" dir with the one in the zip file? Yes I'm a newbie!
Guest Posted December 11, 2002 Posted December 11, 2002 No No No. You will need to alter 2 files located includes/boxes/categories.php includes/classes/boxes.php BACK UP FIRST The only way I could think of doing this seperate and different box was to create a new box section as below. Open up includes/classes/boxes.php Firstly you need to change the code below 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 = ''; to 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 $table_class = ''; Next change the code below around line 26: // class constructor function tableBox($contents, $direct_output = false) { $tableBox_string = '<table border="' . $this->table_border . '" width="' . $this->table_width . '" cellspacing="' . $this->table_cellspacing . '" cellpadding="' . $this->table_cellpadding . '"'; to this: // class constructor function tableBox($contents, $direct_output = false) { $tableBox_string = '<' . $this->table_align . '><table border="' . $this->table_border . '" class="' . $this->table_class . '" width="' . $this->table_width . '" cellspacing="' . $this->table_cellspacing . '" cellpadding="' . $this->table_cellpadding . '"'; Now add the code below around line 80, before class categoriesBox extends tableBox { : class categoriesBox extends tableBox { function categoriesBox($contents) { $info_box_contents = array(); $info_box_contents[] = array('text' => $this->categoriesBoxContents($contents)); $this->table_cellpadding = '0'; $this->table_class = 'noclass'; $this->tableBox($info_box_contents, true); } function categoriesBoxContents($contents) { $this->table_cellpadding = '0'; $this->table_class = 'noclass'; $info_box_contents = array(); $info_box_contents[] = array(array('text' => tep_draw_separator('pixel_trans.gif', '100%', '1'))); for ($i=0; $i<sizeof($contents); $i++) { $info_box_contents[] = array(array('align' => 'center', 'params' => 'class="noclass"', 'text' => $contents[$i]['text'])); } $info_box_contents[] = array(array('text' => tep_draw_separator('pixel_trans.gif', '100%', '1'))); return $this->tableBox($info_box_contents); } } Save and close. Now open up inludes/boxes/categories.php Select all And paste in the code below <?php /* $Id: categories.php,v 1.21 2002/07/03 09:48:06 dgw_ Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2002 osCommerce Released under the GNU General Public License */ function tep_show_category($counter) { global $foo, $categories_string, $id; for ($a=0; $a<$foo[$counter]['level']; $a++) { //$categories_string .= " "; } // display category name if ( ($id) && (in_array($counter, $id)) ) { if ($foo[$counter]['parent'] == 0) { $cPath_new = 'cPath=' . $counter; } else { $cPath_new = 'cPath=' . $foo[$counter]['path']; } // This part leaves out the <a href when each category is selected $categories_string .= '<img src="images/navi/' . $foo[$counter]['name'] . '_n.gif" alt="' . $foo[$counter]['name'] . '" name="' . $foo[$counter]['name'] . '" width="93" height="20">'; $categories_string .= tep_draw_separator('pixel_trans.gif', '100%', '5'); }else{ $categories_string .= '<a href="'; if ($foo[$counter]['parent'] == 0) { $cPath_new = 'cPath=' . $counter; } else { $cPath_new = 'cPath=' . $foo[$counter]['path']; } $categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new); $categories_string .= '">'; $categories_string .= '<img src="images/navi/' . $foo[$counter]['name'] . '.gif" alt="' . $foo[$counter]['name'] . '" name="' . $foo[$counter]['name'] . '" width="93" height="20" border="0"'; $categories_string .= 'hsrc="images/navi/' . $foo[$counter]['name'] . '_h.gif" width="93" height="20" border="0">'; $categories_string .= '</a>'; $categories_string .= tep_draw_separator('pixel_trans.gif', '100%', '5'); } $categories_string .= '<br>'; if ($foo[$counter]['next_id']) { tep_show_category($foo[$counter]['next_id']); } } ?> <!-- categories //--> <tr> <td> <?php $categories_string = ''; $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . $languages_id ."' order by sort_order, cd.categories_name"); while ($categories = tep_db_fetch_array($categories_query)) { $foo[$categories['categories_id']] = array( 'name' => $categories['categories_name'], 'parent' => $categories['parent_id'], 'level' => 0, 'path' => $categories['categories_id'], 'next_id' => false ); if (isset($prev_id)) { $foo[$prev_id]['next_id'] = $categories['categories_id']; } $prev_id = $categories['categories_id']; if (!isset($first_element)) { $first_element = $categories['categories_id']; } } //------------------------ if ($cPath) { $id = split('_', $cPath); reset($id); while (list($key, $value) = each($id)) { $new_path .= $value; unset($prev_id); unset($first_id); $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . $value . "' and c.categories_id = cd.categories_id and cd.language_id='" . $languages_id ."' order by sort_order, cd.categories_name"); $category_check = tep_db_num_rows($categories_query); while ($row = tep_db_fetch_array($categories_query)) { $foo[$row['categories_id']] = array( 'name' => $row['categories_name'], 'parent' => $row['parent_id'], 'level' => $key+1, 'path' => $new_path . '_' . $row['categories_id'], 'next_id' => false ); if (isset($prev_id)) { $foo[$prev_id]['next_id'] = $row['categories_id']; } $prev_id = $row['categories_id']; if (!isset($first_id)) { $first_id = $row['categories_id']; } $last_id = $row['categories_id']; } if ($category_check != 0) { $foo[$last_id]['next_id'] = $foo[$value]['next_id']; $foo[$value]['next_id'] = $first_id; } $new_path .= '_'; } } tep_show_category($first_element); $info_box_contents = array(); $info_box_contents[] = array('align' => 'center', 'text' => $categories_string ); new categoriesBox($info_box_contents); ?> <!-- This is where you will close your center cell and include your right side of your box and then finally close out your custom box. Be sure and leave the "</td> and </tr>" tags. they ensure the sanctity of your overall page layout. //--> </td> </tr> <!-- categories_eof //--> If any one wants the files emailing please [email protected]
Guest Posted December 11, 2002 Posted December 11, 2002 Okay, so I don't need to replace everything. I ONLY need to alter the files as you described? Okay, I may be a newbie to OSC, but I'm not a newbie to programming :) Still learning php though. Thanks for the reply lango!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.