Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Can't get search in Header to work ...


Guest

Recommended Posts

Posted

Hi,

 

I went through the OSC knowledgebase and found a code to put the search box on any page in your store. I put it in my header at:

 

http://www.zawadibooks.com

 

If I click on the advanced search link, that works and I can search using that. But if I put a keyword in the box and click go, it doesn't search. it just blinks and stays on the same page. Any Ideas?

 

This is the code I used. I put in my store web address in place of www.example.com.

 

 

<form name="quick_find" method="get" action="http://www.example.com/advanced_search_result.php">

<input type="text" name="keywords" size="10" maxlength="30" value="" style="width: 115px">

<input type="hidden" name="search_in_description" value="1">

<input type="submit" value="go">

<a href="http://www.example.com/advanced_search.php">Advanced Search</a>

</form>

 

 

I tried the php and HTML combo but I got an error on the create osc box code and just went back to html only.

 

Thanks,

Zbooks

Posted

use the tep_href_link function instead of the hard-coded urls in your form. Actually you could use the tep_draw_form to set it up and pass the tep_href_link for the advanced search page

Posted
use the tep_href_link function instead of the hard-coded urls in your form. Actually you could use the tep_draw_form to set it up and pass the tep_href_link for the advanced search page

 

 

Hahahaha... What? I'm sorry, did I mention I don't have a clue or is it obvious? Hahahahahaha

 

I have no idea what you mean. I wouldn't even have the search bar there if the code wasn't layed out in the knowledgebase but since I sell books, it's pretty neccessary.

Posted

This is the php version in the knowledgebase but I get an error on the osc_draw_input_field part....

 

<?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>';?>

Posted

This is the error I get:

 

Fatal error: Call to undefined function: osc_draw_input_field() in /home/gravit2/public_html/zawadi/includes/header.php on line 83

Posted

Here is what I see from the HTML that is expanded

 

<form name="quick_find" method="get" action="http://www.zawadibooks.com/advanced_search.php"><input type="hidden" name="osCsid" value="64fb4b69251971c215813b5ce0dc8698" />
<input type="text" name="keywords" size="10" maxlength="30" value="" style="width: 115px">
<input type="hidden" name="search_in_description" value="1">
<input type="submit" value="go">
<a href="http://www.zawadibooks.com/advanced_search.php">Advanced Search</a>
</form>

 

thre is the slash at the end of the id string which maybe invalidate the session field

8" />

 

the last link should also have a session appended which I dont see. Seems you're still using the hard-coded values

Posted
Here is what I see from the HTML that is expanded

 

<form name="quick_find" method="get" action="http://www.zawadibooks.com/advanced_search.php"><input type="hidden" name="osCsid" value="64fb4b69251971c215813b5ce0dc8698" />
<input type="text" name="keywords" size="10" maxlength="30" value="" style="width: 115px">
<input type="hidden" name="search_in_description" value="1">
<input type="submit" value="go">
<a href="http://www.zawadibooks.com/advanced_search.php">Advanced Search</a>
</form>

 

thre is the slash at the end of the id string which maybe invalidate the session field

8" />

 

the last link should also have a session appended which I dont see. Seems you're still using the hard-coded values

 

 

Oh what you saw was me changing back to the html version after trying your suggestion. I put what you said to put there and it got rid of the errors but still wouldn't search so for some reason I put the original html code back.

 

I can put the php/html code back if you can take a look at it then. It looked ok but wouldn't search like the html version.

 

Thanks.

Posted

try this

 <?php echo tep_draw_form('search', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get') . tep_image_submit('button_search.gif', BOX_HEADING_ADVSEARCH, 'align="top" height="19" width="55"') . '  ' .  tep_draw_hidden_field('search_in_description','1') . tep_draw_input_field('keywords', '', 'size="10" maxlength="45" style="width:210px"') . '</form>'; ?>

 

dahui

 

2b seen on funjumping.de/shop

Posted
try this

 <?php echo tep_draw_form('search', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get') . tep_image_submit('button_search.gif', BOX_HEADING_ADVSEARCH, 'align="top" height="19" width="55"') . '  ' . ?tep_draw_hidden_field('search_in_description','1') . tep_draw_input_field('keywords', '', 'size="10" maxlength="45" style="width:210px"') . '</form>'; ?>

 

dahui

 

2b seen on funjumping.de/shop

 

 

It at least changes the page but then says "product not found" which isn't true. Went back to php/html broken code.

Posted
It at least changes the page but then says "product not found" which isn't true.  Went back to php/html broken code.

 

workz perfect for me, so can you post a link where my snipplet is running on yr server, tha I can chack better

 

dahui

Posted
workz perfect for me, so can you post a link where my snipplet is running on yr server, tha I can chack better

 

dahui

 

 

I removed it thanks.

 

It was in the header.

Posted

So should I just assume I'm not going to get the search to work in the header and give up?

Posted

You could always strip down the search box and just add the code to call it in your header where you want it to show up.

 

If you replace your search.php file with this code

<?php
/*
 $Id: search.php,v 1.22 2003/02/10 22:31:05 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/
?>
<!-- search //-->
<table border="0" cellpadding="0" cellspacing="0"><tr>
           <td>
<?php
$info_box_contents = array();
 $info_box_contents[] = array('form' => tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get'),
                              'align' => 'center',
                              'text' => tep_draw_input_field('keywords', '', 'size="10" maxlength="30" style="width: ' . (BOX_WIDTH-30) . 'px"') . ' ' . tep_hide_session_id() . tep_image_submit('button_quick_find.gif', BOX_HEADING_SEARCH) . '');

 new infoBox($info_box_contents);
?>
           </td>
         </tr></table>
<!-- search_eof //-->

that removes the header, the words Advanced Search and the text description then add

<?php require(DIR_WS_BOXES . 'add2favorites.php'); ?> in your header where you want it, it should work. Depending on where you put it though it could knock things out of wack because it will still have the spacer gif above and below it that is called from the boxes.php class file and it will have the same background as the infoboxes... but atleast it is a start and it works. :)

Wendy James

 

Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.

Posted

Or if you wanted a fancy search box in your header you could use the

Advanced Search Infobox v1.00

or any of the other search box contributions.

http://www.oscommerce.com/community?contri...box&category=11

 

Boxes will work no matter where you put them. They do not have to go in a column.

Wendy James

 

Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.

Posted
Or if you wanted a fancy search box in your header you could use the

Advanced Search Infobox v1.00

or any of the other search box contributions.

http://www.oscommerce.com/community?contri...box&category=11

 

Boxes will work no matter where you put them. They do not have to go in a column.

 

 

Thanks Wendy. I will try your suggestions. The search box codes I've gotten from the knowledge base and users weren't working in my header. I'll try the code you listed and then the contribution if it's not too ugly.

 

Thanks again.

Posted
Thanks Wendy.  I will try your suggestions.  The search box codes I've gotten from the knowledge base and users weren't working in my header.  I'll try the code you listed and then the contribution if it's not too ugly. 

 

Thanks again.

 

The search code doesn't work and neither does any of the contributions. I think there is something different about putting the search in the header, verses a box. The search boxes can be placed anywhere but don't work anywhere. When I put the code above and used two search box contributions, they install nicely but when you try to use the search box, the screen just refreshes and doesn't change.

 

The code doesn't seem to be searching for anything or searching the database, I don't know. Man... I need this search bar in the header. ... Searching for books from the side is not as easy as from the header... wow. This seems so doabled. I don't understand why it's not working...

 

*Sigh*

Posted

The closest I've fotten so far is the dhui suggestion. Only it says product not found when the product is there and searchable using advanced search.

Posted

as long as you have this in your html aint gonna work

value="f84058a29c3c47fcd8b1aeb2223c0b76" />

that / slash, and you need the sessions appended to the end of your links as we said earlier. And you should fix the BOX_HEADING_ADVSEARCH to be BOX_SEARCH_ADVANCED_SEARCH.

Posted
as long as you have this in your html aint gonna work

value="f84058a29c3c47fcd8b1aeb2223c0b76" />

that / slash, and you need the sessions appended to the end of your links as we said earlier. And you should fix the BOX_HEADING_ADVSEARCH to be BOX_SEARCH_ADVANCED_SEARCH.

 

 

Ok, I don't fully understand please. Here is the code I have in the header:

 

<div style=" padding-top:2px" align="center">Keyword Book Search:

<?php echo tep_draw_form('search', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get') . tep_image_submit('button_search.gif', BOX_HEADING_ADVSEARCH, 'align="top" height="19" width="55"') . '  ' . tep_draw_hidden_field('search_in_description','1') . tep_draw_input_field('keywords', '', 'size="10" maxlength="45" style="width:210px"') . '</form>'; ?>

 

 

What do I need to change? I changed the BOX_SEARCH line as you have said but I don't see the value info you posted...

 

Actually now that I changes the BOx_SEARCH line like you said, it doesn't work at all....

 

:(

Posted

ok let see if the code from the default search box works try this and leave it on your page so I can see the html code generated

 

<div style=" padding-top:2px" align="center">Keyword Book Search:
<?php echo tep_draw_form('quick_find', 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_hide_session_id() . tep_image_submit('button_search.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>'; ?>

Posted
ok let see if the code from the default search box works try this and leave it on your page so I can see the html code generated

 

<div style=" padding-top:2px" align="center">Keyword Book Search:
<?php echo tep_draw_form('quick_find', 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_hide_session_id() . tep_image_submit('button_search.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>'; ?>

 

ok. I'm putting it on right now

Posted
ok let see if the code from the default search box works try this and leave it on your page so I can see the html code generated

 

<div style=" padding-top:2px" align="center">Keyword Book Search:
<?php echo tep_draw_form('quick_find', 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_hide_session_id() . tep_image_submit('button_search.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>'; ?>

 

 

There it is.

Posted

ok I see, try this:

 

<?php echo tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get'); ?>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr><td><?php echo tep_draw_input_field('keywords', '', 'size="10" maxlength="30" style="width: ' . (BOX_WIDTH-30) . 'px"') . ' ' . tep_hide_session_id() . tep_image_submit('button_search.gif', BOX_HEADING_SEARCH) . '<br>' . BOX_SEARCH_TEXT . '<br><a href="' . tep_href_link(FILENAME_ADVANCED_SEARCH) . '"><b>' . BOX_SEARCH_ADVANCED_SEARCH . '</b></a></td></tr></table></form>'; ?>

Keeps inserting the / the tep_draw_form function for some reason so I setup a separate table.

Archived

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

×
×
  • Create New...