Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

incoporate a search feature into the header


timisnumber9

Recommended Posts

Posted

Does any body know how to combine the search box into the header?

 

I have seen a few sites with this feature such as this:

 

example site

 

That has the search box incoporated into the header and not in a separate infoBox in the left or right column.

 

Has anbody here done this? What code did they use?

 

Cheers, Tim

Posted
Does any body know how to combine the search box into the header?

 

I have seen a few sites with this feature such as this:

 

example site

 

That has the search box incoporated into the header and not in a separate infoBox in the left or right column.

 

Has anbody here done this?  What code did they use?

 

Cheers, Tim

 

 

Here's a quick way :)

 

<!-- Search Form Begin -->
              <form name="quick_find" action="advanced_search_result.php" method="get"><input type="text" name="keywords" size="15" height="10"  maxlength="72" value="Baby Doll" onFocus="this.value=''">
<input type="submit" value="Search"  border="0" align="absmiddle" alt="Quick Find" border="0">
</form> 
<!-- Search Form End -->    

Posted
Cheers, i will give it a go and let you know how it goes.

 

Cheers, Tim :thumbsup:

 

 

Here is the code:

 

 

<?php

 

if ( (!strstr($_SERVER['PHP_SELF'],'checkout.php')) and (!strstr($_SERVER['PHP_SELF'],'create_account.php')) and (!strstr($_SERVER['PHP_SELF'],'advanced_search.php'))) {?>

<?php echo tep_draw_form('advanced_search', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'GET') ?>

<table bgcolor="#D8E8F5" border="0" width="100%" cellspacing="0" cellpadding="0" align="center">

<tr>

<td height="5"></td>

</tr>

 

<tr >

<td width="30%"></td>

<td nowrap valign="middle" ><font size="2"><?php echo BOX_HEADING_SEARCH . ': ';?></font></td>

<td valign="middle" ><?php echo tep_draw_hidden_field('search_in_description','1') . tep_draw_input_field('keywords', '', 'size="10" maxlength="30" style="width: ' . (BOX_WIDTH) . 'px"') ?></td>

<td valign="middle" > </td>

<td nowrap valign="middle" ><font size="2"><?php echo BOX_ADVSEARCH_CAT ?></font></td>

<td valign="middle" ><?php echo tep_draw_pull_down_menu('categories_id', tep_get_categories(array(array('id' => '', 'text' => BOX_ADVSEARCH_ALLCAT)))) ?></td>

<td valign="middle" > </td>

<td valign="top" ><center><?php echo tep_image_submit('go.gif', BOX_HEADING_ADVSEARCH); ?></center></td>

<td width="30%"></td>

</tr>

<tr>

<td height="5"></td>

</tr>

 

</table>

</form>

<?php

}

?>

Treasurer MFC

Posted
Thanks for that!  That is exactly what i was after!

 

Cheers, Tim  :thumbsup:

 

 

Nice script. Thanks, will use that from now on. :) :thumbsup:

Posted
Nice script. Thanks, will use that from now on. :) :thumbsup:

 

 

if you want it to search in subdirectories as well,

 

change this line :

 

<td valign="middle" ><?php echo tep_draw_hidden_field('search_in_description','1') . tep_draw_input_field('keywords', '', 'size="10" maxlength="30" style="width: ' . (BOX_WIDTH) . 'px"') ?></td>

 

 

to this:

 

<td valign="middle" ><?php echo tep_draw_hidden_field('inc_subcat','1') . tep_draw_hidden_field('search_in_description','1') . tep_draw_input_field('keywords', '', 'size="10" maxlength="30" style="width: ' . (BOX_WIDTH) . 'px"') ?></td>

Treasurer MFC

Posted

Where do you put this code?

i can't seem to find it in my cpanel?

Posted
I don't know what a Cpanel is.

 

I put it in Header.php and footer.php

 

 

Amanda,

 

Where do I change the text BOX_ADVSEARCH_CAT & BOX_ADVSEARCH_CAT - I should know this one... but my brain hurts. :blink:

 

You can see it |:: Here ::| on the bottom of the page

 

Thanks for the help. :)

Archived

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

×
×
  • Create New...