Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Custom Search Box


ryanf

Recommended Posts

HI, I am trying to figure out a way to take away the seach box and in the header, put this:

 

search |___________| |Catagory \/| |GO|

 

search -- search field text box -- catagory pulldown menu -- go.gif

 

So they could select the specific catagory to search in or just leave it at it's default all catagories. Thanks for the help.

If I was crafty, this would be a funny signature.

Link to comment
Share on other sites

Thats part of it, but I want to get rid of the box all together also.

 

Anyone know how to get the Colored enhanced search box to work? Search didn't come up with a thread on it.

 

Thanks

If I was crafty, this would be a funny signature.

Link to comment
Share on other sites

get rid of the box all together

To put the enhanced search box in the header, you would need to cut the "require(DIR_WS_BOXES . 'search.php');" line of code in includes/column_left.php and paste it into includes/header.php whever you want it to show.

 

To change the layout of the box to meet your needs, you would need to do that yourself through code and the stylesheet.

I'd rather be flying!

Link to comment
Share on other sites

ok, I pieced together the code and put it in my header.php file and everything shows up the way I want it too but when I hit the submit button, it is not doing anything. How do I called the search function? Here is my code:

 

<?php echo tep_draw_input_field('keywords','','size="10" maxlength="30" style="width: ' . (BOX_WIDTH-30) . 'px"'); ?>
<?php echo tep_draw_pull_down_menu('categories_id', tep_get_categories(array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES)))); ?>
<a href="<?php echo tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false); ?>"><?php echo tep_image_submit('button_quick_find.gif', IMAGE_BUTTON_SEARCH); ?></a>

If I was crafty, this would be a funny signature.

Link to comment
Share on other sites

<?php
 $info_box_contents = array();
 $info_box_contents[] = array('text' => BOX_HEADING_SEARCH);

 new infoBoxHeading($info_box_contents, false, false);

 $info_box_contents = array();
 $info_box_contents[] = array('form' => tep_draw_form('advanced_search', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get'),
                              'align' => 'left',
                              'text' => BOX_SEARCH_TEXT . '<br>' .  tep_draw_hidden_field('search_in_description','1') .  tep_draw_hidden_field('inc_subcat', '1', true) . tep_draw_input_field('keywords','','size="10" maxlength="30" style="width: ' . (BOX_WIDTH-30) . 'px"') . tep_image_submit('button_quick_find.gif', IMAGE_BUTTON_SEARCH) . '<br>' .tep_draw_pull_down_menu('categories_id', tep_get_categories(array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES)))) . '<br><a href="' . tep_href_link(FILENAME_ADVANCED_SEARCH) . '"><b>' . BOX_SEARCH_ADVANCED_SEARCH . '</b></a>');

 new infoBox($info_box_contents);
?>

 

But if I include the form call wont that then create the box? I dont want that. I have the layout exactly how I want it (see screenshot below).

screenshot.gif

 

Can anyone tell me what the link code should be?

If I was crafty, this would be a funny signature.

Link to comment
Share on other sites

Sorry, I didn't mean for you to include your code in search.php. I meant for you to look at how the form is called in search.php. The form does not draw the box, the form is what submits your info back to the server. Here is the full code that you are looking for. Paste this into your header.php where you want the search form:

 

<?php echo tep_draw_form('advanced_search', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get')
. tep_draw_input_field('keywords','','size="10" maxlength="30" style="width: ' . (BOX_WIDTH-30) . 'px"') 
. tep_draw_pull_down_menu('categories_id', tep_get_categories(array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES))))?>
<a href="<?php echo tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false); ?>"><?php echo tep_image_submit('button_quick_find.gif', IMAGE_BUTTON_SEARCH); ?></a>
</form>

I'd rather be flying!

Link to comment
Share on other sites

thanks for the help but that code isn't working. It just reloads the main page. Could it be that it is also looking for the manufactures field too since that was what the contribution I added originally did?

If I was crafty, this would be a funny signature.

Link to comment
Share on other sites

Not sure. When I cut-n-paste that code into my header.php it works fine. You can see it on my test site.

 

Put in the word mouse in the search box and pick any category other than mice. It won't find anything. Now search for mouse in the mice category and it will find them. Or search for mouse in all categories.

I'd rather be flying!

Link to comment
Share on other sites

HI, I am trying to figure out a way to take away the seach box and in the header, put this:

 

search |___________| |Catagory \/| |GO|

 

search -- search field text box -- catagory pulldown menu -- go.gif

 

So they could select the specific catagory to search in or just leave it at it's default all catagories.  Thanks for the help.

I'm not sure if this will help but this is what I use for my search function. See my site for an example.

 

  <form name="quick_find" action="<?php echo tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'SSL'); ?>" method="get">
           Search <input type="hidden" name="osCsid" value="" />
     <input type="text" name="keywords" value="Type word(s) and press enter" onFocus="form.keywords.value='';" size="
     27" maxlength="35" style="">
     <input type="hidden" name="osCsid" value="">
     <?php echo '<a href="' . tep_href_link(FILENAME_ADVANCED_SEARCH, '', 'NONSSL') . '">' .  'Advanced Search' . '</a>'; ?>
</form>

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Thanks for the help everyone. I got it to work. I had a contrib search enhancements in and it was causing it to think that I wasn't typing any word in and also I added a <form> tag infront of the code above and that would cause to to just reload the page for some reason. Thanks!

If I was crafty, this would be a funny signature.

Link to comment
Share on other sites

Ok, it stopped working again. Now everytime I enter a seach value it goes to the Advance Search screen saying "At least one of the fields in the search form must be entered." I don't know what is wrong but I think that no session id is being passed around since when I view source there is no ID like other sites that I have checked out.

 

Here is the code that I am using for my search function?:

 

Search: 
<?php echo tep_draw_form('advanced_search', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get')
. tep_draw_input_field('keywords','','size="10" maxlength="30" style="width: ' . (BOX_WIDTH-30) . 'px"') 
. ' ' . tep_draw_pull_down_menu('categories_id', tep_get_categories(array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES))))?>
</td>
<td valign="middle" width="30" align="center">

<a href="<?php echo tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false); ?>" onMouseOver="if(document.images) document.search.src='images/index/go_on.gif';" onMouseOut="if(document.images) document.search.src='images/index/go_off.gif';"
onFocus="if(this.blur)this.blur();"><img name="search" src="images/index/go_off.gif" border="0"></a>
</form>

 

and here is my site if you want to check it out www.abdulky.com

 

I just uploaded an unmodified advance_search_results.php to try that but it didn't work either.

 

Thanks

If I was crafty, this would be a funny signature.

Link to comment
Share on other sites

One more try... Ok, I fixed the part where it wouldn't think I entered anything. I changed the link to an input and that works fine now. If I enter a keyword and hit search it works fine if the catagories is set to "All Catagories" but if I change the catagorie to anything else, it doesn't find anything. Even if I change it to that catagorie the object I am searching for is in. Whats going on?

If I was crafty, this would be a funny signature.

Link to comment
Share on other sites

Now I know exactly what is happening. It works fine if I am say searching for mouse and I use the catagory mice, but when I use the catagory hardware, it finds nothing. The search is not looking through the sub catagories of the parent class. But, when using the advanced search it does. Aren't they both calling the same function? How do I fix this?

If I was crafty, this would be a funny signature.

Link to comment
Share on other sites

  • 1 year later...
Now I know exactly what is happening. It works fine if I am say searching for mouse and I use the catagory mice, but when I use the catagory hardware, it finds nothing. The search is not looking through the sub catagories of the parent class. But, when using the advanced search it does. Aren't they both calling the same function? How do I fix this?

 

Good question! OSC Site I am working on sells music/cd's... setup is catagory/band name(subcatagory)/album(product) so when I search for a band name I get nadda, neither in basic or advanced search. What's up with That I wonder? Any assistance is appreciated.

Link to comment
Share on other sites

  • 1 year later...

hi,

 

does anyone know how to replace the 'submit' image with text?

 

been trying loads of things and I cant get it to work! I can get it to display text instead of the image, but it wont link!

 

If anyone has done this, any chance of the code?

 

thanks in advance for your help!!

Link to comment
Share on other sites

  • 5 months later...
hi,

 

does anyone know how to replace the 'submit' image with text?

 

been trying loads of things and I cant get it to work! I can get it to display text instead of the image, but it wont link!

 

If anyone has done this, any chance of the code?

 

thanks in advance for your help!!

I need this too been trying for ages but the link never works correctly any help please

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...