mark27uk3 Posted March 8, 2004 Share Posted March 8, 2004 Hi Guys, How do I add a drop down menu to the header that displays the categorys? I have move the search box into the header and I would like to add a drop down menu next to it. Any ideas? Thanx Mark :huh: Lifes a bitch, then you marry one, then you die! Link to comment Share on other sites More sharing options...
burt Posted March 8, 2004 Share Posted March 8, 2004 I believe that there is a contribution which does exactly this. The other option is to grab the relevant code from admin/categories.php and replicate on the catalog side in the file header.php wherever you want it. You will also need to port over some functions but this is easy enough. Link to comment Share on other sites More sharing options...
mark27uk3 Posted March 8, 2004 Author Share Posted March 8, 2004 Hi Burt, I found a contrib and grabbed this bit of code from it $categories_array = tep_get_categories($cat_choose); for ($i=0; $i<sizeof($categories_array); $i++) { /* tep_get_parent_categories($parent_categories, $categories_array[$i]['id']); for ($j = sizeof($parent_categories) - 1; $j>=0; $j--) { $path = ($path == "") ? $parent_categories[$j] : ($path . "_" .. $parent_categories[$j]); } $categories_array[$i]['id'] = ($path == "") ? $categories_array[$i]['id'] : ($path . "_" . $categories_array[$i]['id']); */ } $info_box_contents[] = array('form' => '<form action="' . tep_href_link(FILENAME_DEFAULT) . '" method="get">', 'align' => 'left', 'text' => tep_draw_pull_down_menu('cPath', $categories_array,'','onChange="this.form.submit();" size="' . ((sizeof($categories_array) < MAX_MANUFACTURERS_LIST) ? sizeof($categories_array) : MAX_MANUFACTURERS_LIST) . '" style="width:150"') ); new infoBox($info_box_contents); I inserted it into my header and this is what it looks like now, I need to have it next to the search box (see screenshot below). <?php /* $Id: header.php,v 1.42 2003/06/10 18:20:38 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ define('DIR_WS_TEMPLATE_IMAGES', 'templates/Original/images/'); // WebMakers.com Added: Down for Maintenance // Hide header if not to show //BORDER AROUND CART print ('<table width="800" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#000000"> <tr> <td bgcolor="#FFFFFF">'); ?> <table width="100%" cellpadding="10" cellspacing="0" border="0" BGCOLOR="#ffffff"> <tr><td> <table border="0" width="100%"><tr><td> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr class="header"> <td valign="middle"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_TEMPLATE_IMAGES . 'logo.gif', 'Store Logo') . '</a>'; ?></td> <td align="center" valign="bottom"> <img src="network_selection.gif" width="321" height="33" border="0"> <td align="right" valign="bottom"><?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_account.gif', HEADER_TITLE_MY_ACCOUNT) . '</a> <a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '">' . tep_image(DIR_WS_IMAGES . 'header_cart.gif', HEADER_TITLE_CART_CONTENTS) . '</a> <a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_checkout.gif', HEADER_TITLE_CHECKOUT) . '</a>'; ?> </td> <td align="center" valign="bottom"> <img src="freedelivery.gif" width="217" height="33" border="0"> </td> <php? //BOF added category and mennu tabs ?> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr><td> <?php include(DIR_WS_INCLUDES . 'cat_menu.php'); ?> </td> </tr> <php? // EOF: Added: Category and menu tabs ?> <tr class="headerNavigation"> <td align="center" height="20"><font face=Verdana, size=1 arial,="undefined" helvetica,="undefined" sans-serif="undefined" color="#ffffff"><b>UK Sales & Customer Service: Monday-Friday 9am-5.30pm </b></font> </td> </td> </tr> <tr bgcolor="#FFFFCC" align="center"> <td colspan="2" height="20"><font face=Verdana, size=1 arial,="undefined" helvetica,="undefined" sans-serif="undefined"><font color="#000066"> </font> <?php $hide = tep_hide_session_id(); echo '<form name="quick_find" method="get" action="' . tep_href_link (FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false) . '">'; echo $hide . '<input type="text" name="keywords" onFocus=this.value="" size="20" maxlength="30" value="' . BOX_SEARCH_TEXT . '"> ' . '<input type="submit" value="Go"><br><a href="' . tep_href_link(FILENAME_ADVANCED_SEARCH) . '">' . BOX_SEARCH_ADVANCED_SEARCH . tep_draw_hidden_field('search_in_description', '1') . '</a>'; echo '</form>'; $categories_array = tep_get_categories($cat_choose); for ($i=0; $i<sizeof($categories_array); $i++) { /* tep_get_parent_categories($parent_categories, $categories_array[$i]['id']); for ($j = sizeof($parent_categories) - 1; $j>=0; $j--) { $path = ($path == "") ? $parent_categories[$j] : ($path . "_" .. $parent_categories[$j]); } $categories_array[$i]['id'] = ($path == "") ? $categories_array[$i]['id'] : ($path . "_" . $categories_array[$i]['id']); */ } $info_box_contents[] = array('form' => '<form action="' . tep_href_link(FILENAME_DEFAULT) . '" method="get">', 'align' => 'left', 'text' => tep_draw_pull_down_menu('cPath', $categories_array,'','onChange="this.form.submit();" size="' . ((sizeof($categories_array) < MAX_MANUFACTURERS_LIST) ? sizeof($categories_array) : MAX_MANUFACTURERS_LIST) . '" style="width:150"') ); new infoBox($info_box_contents); ?> </td> </tr> </table></td></tr></table> Any ideas how to change?? Thanx Mark Lifes a bitch, then you marry one, then you die! Link to comment Share on other sites More sharing options...
241 Posted March 8, 2004 Share Posted March 8, 2004 place the code inside its own td tags as for the free delivery this would require re structure of the table and would result in a return to almost what you had originally 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! Is your Osc dated try Phoenix raising oscommerce from the ashes. Link to comment Share on other sites More sharing options...
mark27uk3 Posted March 8, 2004 Author Share Posted March 8, 2004 Hi, I have inserted the <td> tags. What do I need to change to remove the info box that it is in and place it to the left of the search box. Thanx Mark Lifes a bitch, then you marry one, then you die! Link to comment Share on other sites More sharing options...
241 Posted March 8, 2004 Share Posted March 8, 2004 you also need to change the code that you have which has been lifted from a box. look at the code for the search it should give you an idea you are to remove the references to infobox array and recode 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! Is your Osc dated try Phoenix raising oscommerce from the ashes. Link to comment Share on other sites More sharing options...
mark27uk3 Posted March 8, 2004 Author Share Posted March 8, 2004 Hi, This is the code, $categories_array = tep_get_categories($cat_choose); for ($i=0; $i<sizeof($categories_array); $i++) { /* tep_get_parent_categories($parent_categories, $categories_array[$i]['id']); for ($j = sizeof($parent_categories) - 1; $j>=0; $j--) { $path = ($path == "") ? $parent_categories[$j] : ($path . "_" .. $parent_categories[$j]); } $categories_array[$i]['id'] = ($path == "") ? $categories_array[$i]['id'] : ($path . "_" . $categories_array[$i]['id']); */ } $info_box_contents[] = array('form' => '<form action="' . tep_href_link(FILENAME_DEFAULT) . '" method="get">', 'align' => 'left', 'text' => tep_draw_pull_down_menu('cPath', $categories_array,'','onChange="this.form.submit();" size="' . ((sizeof($categories_array) < MAX_MANUFACTURERS_LIST) ? sizeof($categories_array) : MAX_MANUFACTURERS_LIST) . '" style="width:150"') ); new infoBox($info_box_contents); I presume I have to change the array to a <php? <?php. I dont know which parts can be excluded. Thanx Mark Lifes a bitch, then you marry one, then you die! Link to comment Share on other sites More sharing options...
findtim Posted March 10, 2004 Share Posted March 10, 2004 hi can i just ask a sideline questionher, how do i get rid of the space that the "welcome" creates, i want to place a table ofinfo whee your "unlicensed evaluation" words are but my table is way down the page. any hints grately appreciated tim Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.