Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

adding search bar to pages with existing form submission??

Rachael w.

Recommended Posts

would like to place a search box at the top of every page. It is working fine however, on those pages with an existing form submission I just cant get it to work properly (buttons, forms, and such mess it up). I just dont know exactly how or where to put the code.


I found this in the knowledge base, kinda explains what I'm trying to do:


Using HTML and PHP Code


Using HTML and PHP code allows the session ID to be retained, but can only be used on pages inside the osCommerce installation. Be careful not to place this code inside of an existing form submission however!



<?php echo tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get') . osc_draw_input_field('keywords', '', 'size="10" maxlength="30" style="width: ' . (BOX_WIDTH-30) . 'px"') . ' ' . tep_hide_session_id() . osc_draw_hidden_field('search_in_description' , '1') . tep_image_submit('button_quick_find.gif', BOX_HEADING_SEARCH) . '<br>' . BOX_SEARCH_TEXT . '<br><a href="' . tep_href_link(FILENAME_ADVANCED_SEARCH) . '"><b>' . BOX_SEARCH_ADVANCED_SEARCH . '</b></a></form>';?>


The actual code I am using is this:

<td><table border="0" width="100%" cellspacing="1" cellpadding="1" bgcolor="ADC593" align="right">
	<td class="searchbar" align="left"> <?php echo $breadcrumb->trail('>'); ?>
	<td align="right"> <?php echo tep_draw_form('search', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get') . tep_draw_hidden_field('search_in_description','1') . tep_draw_input_field('keywords', '', 'size="20" maxlength="30" ONFOCUS="clearDefault(this)" style="width="30": ' . (BOX_WIDTH+10) . 'px"') . ' ' . tep_draw_pull_down_menu('categories_id', tep_get_categories(array(array('id' => '', 'text' => BOX_ALL_CATEGORIES)))) . ' ' . tep_hide_session_id() . tep_image_submit('button_search.gif', IMAGE_BUTTON_SEARCH, 'align="top"') . '</form>'; ?></td>


How exactly would I get that code to work on the product_info and shopping cart pages for example? Since those pages start right off with a form submission type line?


I want the bar for the code at the very top of the page, but not in the header. I hope I explained that correctly. Here's a link to my test site so you can see what I'm trying to accomplish.


Thank you all in advance for your help.

Link to comment
Share on other sites


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

  • Create New...