Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

dual search, hearder and infobox


Guest

Recommended Posts

How can I make it possible to use a search in my header as well as my infobox?

Right now I have it setup, with some problems, using the same code from the infobox.

 

Currently its fishy how its working --

 

Infobox works fine, searches are completed correctly to the results page. However, when searching from the header, It returns a search result error 'At least one of the fields in the search form must be entered.'

 

But, when the same text is in both search strings in header and infobox and clicking the search button from the header, the results show correctly.

 

Is there a quick fix to say when entering information into either box, the same text will be entered into both? Or is there some way I can make this work differently?

Link to comment
Share on other sites

How can I make it possible to use a search in my header as well as my infobox?

Right now I have it setup, with some problems, using the same code from the infobox.

 

Currently its fishy how its working --

 

Infobox works fine, searches are completed correctly to the results page. However, when searching from the header, It returns a search result error 'At least one of the fields in the search form must be entered.'

 

But, when the same text is in both search strings in header and infobox and clicking the search button from the header, the results show correctly.

 

Is there a quick fix to say when entering information into either box, the same text will be entered into both? Or is there some way I can make this work differently?

If you used the exact same code from the infobox to make the form in your header, you may be running into a problem since both forms have the exact same name... Try changing the name on one of them and see if it helps...

 

Richard.

Richard Lindsey

Link to comment
Share on other sites

If you used the exact same code from the infobox to make the form in your header, you may be running into a problem since both forms have the exact same name... Try changing the name on one of them and see if it helps...

 

Richard.

 

Same thing...

 

here is my header search code:

 

<? // SEARCH ?>
	  <?=tep_draw_form('header_search', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get')?>
  <?=tep_draw_input_field('headersearch', '', ' maxlength="50"	onclick="this.value=\'\'" name="headsearch" value="Search" id="headersearch" class=input') . '' . tep_hide_session_id()?>
  <input name="submit" type=image src="images/button_search.jpg" align="top"/>
	  <? // END SEARCH ?>

 

and my infobox code

 

$info_box_contents[] = array('form' => tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get'),
						   'align' => 'left',
						   'text' => '<table width="100%" border="0">
 <tr>
<td align="right">'.tep_draw_input_field('keywords', '', 'size="10" maxlength="60" class="rig1input" ').'</td>
<td align="left" valign="middle"><img height="2" alt="" src="images/spacer.gif">' . tep_hide_session_id() .''. tep_image_submit('button_search.jpg', BOX_HEADING_SEARCH) . '</td>
 </tr>
</table><center><a href="' . tep_href_link(FILENAME_ADVANCED_SEARCH) . '" style="text-transform:lowercase;">' . BOX_SEARCH_ADVANCED_SEARCH . '</a></center>');

Link to comment
Share on other sites

Same thing...

 

here is my header search code:

 

<? // SEARCH ?>
	  <?=tep_draw_form('header_search', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get')?>
  <?=tep_draw_input_field('headersearch', '', ' maxlength="50"	onclick="this.value=\'\'" name="headsearch" value="Search" id="headersearch" class=input') . '' . tep_hide_session_id()?>
  <input name="submit" type=image src="images/button_search.jpg" align="top"/>
	  <? // END SEARCH ?>

 

and my infobox code

 

$info_box_contents[] = array('form' => tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get'),
						   'align' => 'left',
						   'text' => '<table width="100%" border="0">
 <tr>
<td align="right">'.tep_draw_input_field('keywords', '', 'size="10" maxlength="60" class="rig1input" ').'</td>
<td align="left" valign="middle"><img height="2" alt="" src="images/spacer.gif">' . tep_hide_session_id() .''. tep_image_submit('button_search.jpg', BOX_HEADING_SEARCH) . '</td>
 </tr>
</table><center><a href="' . tep_href_link(FILENAME_ADVANCED_SEARCH) . '" style="text-transform:lowercase;">' . BOX_SEARCH_ADVANCED_SEARCH . '</a></center>');

Oh, it's because you're sending it to the same form processor, but you're changing the name of the field from "keywords" to "headersearch"... In that form processor, it checks to see if "keywords" is empty, and spits an error if it is... Since you're not sending back a "keywords" field, it's failing and saying you have to put something... Leave the form name different like you have it above, but change the input field to "keywords", the same as it is in the infobox code...

 

Richard.

Richard Lindsey

Link to comment
Share on other sites

well it's still looking for text in the infobox for some reason.

 

Am I able to just copy the dvanced_search_result.php, rename it - and change the instances of 'keywords' or $keywords to a new string? and on the header search make that form action change too?

Link to comment
Share on other sites

well it's still looking for text in the infobox for some reason.

 

Am I able to just copy the dvanced_search_result.php, rename it - and change the instances of 'keywords' or $keywords to a new string? and on the header search make that form action change too?

Yeahhhhhhh you could do that, but it would be kind of a waste of resources, just to add a new header bar that uses all of the same processing capabilities as is in that file already... When you say "it's still looking for text in the infobox for some reason", how are you coming to this conclusion? What makes you think it's looking to the infobox for some text, or is this just a guess?

 

Richard.

Richard Lindsey

Link to comment
Share on other sites

I say that because Ive changed the name of the header search to 'header_search' it was 'quick_find' just as the search infobox.

Changed the text field back to keywords as suggested above...

 

When I preform the search from the header with the above conditions, infobox still on, the results come back with 'At least one of the fields in the search form must be entered.' -- again, searching from the header search and null in the infobox.

 

But with the same conditions, entering 'test' into the infobox, null in the header... AND clicking search button from the HEADER.... results come back correctly, showing search results.

 

Same thing, same conditions, test entered into both header search text area and infobox... results come back correct.

But.... entering 'test' into the infobox text field and 'search' into the header - only yields results of 'test'.

Link to comment
Share on other sites

I say that because Ive changed the name of the header search to 'header_search' it was 'quick_find' just as the search infobox.

Changed the text field back to keywords as suggested above...

 

When I preform the search from the header with the above conditions, infobox still on, the results come back with 'At least one of the fields in the search form must be entered.' -- again, searching from the header search and null in the infobox.

 

But with the same conditions, entering 'test' into the infobox, null in the header... AND clicking search button from the HEADER.... results come back correctly, showing search results.

 

Same thing, same conditions, test entered into both header search text area and infobox... results come back correct.

But.... entering 'test' into the infobox text field and 'search' into the header - only yields results of 'test'.

Can I get a link to the site this is happening on?

 

Richard.

Richard Lindsey

Link to comment
Share on other sites

*bump*

Ok, I see 2 things wrong in your html source... 1 is that you don't have a </form> tag to close out your header_search form, so that form is bleeding over into your next form, which is probably why you're pulling back results from the other form when you submit from the first one... The other problem is that you still haven't changed your input box in the header_search form to have a name of "keywords"... You gave it a name of "headkeywords", which isn't right... Change that to "keywords", and add in a </form> tag after the submit button, and it should start behaving normally...

 

Richard.

Richard Lindsey

Link to comment
Share on other sites

Thanks Richard ;)

 

Yeah had made the 'headkeywords' in anticipation of having to create a new search results page...

 

And as much searching ive done just for a missing </form> tag.... I appreciate it, I totally missed it.

 

Thanks again

Link to comment
Share on other sites

Thanks Richard ;)

 

Yeah had made the 'headkeywords' in anticipation of having to create a new search results page...

 

And as much searching ive done just for a missing </form> tag.... I appreciate it, I totally missed it.

 

Thanks again

Does that mean it's working right for you now?

 

Richard.

Richard Lindsey

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...