Jump to content
Sign in to follow this  
Margo

Search product description from initial searchbox?

Recommended Posts

I downloaded Peter Schapler's SearchBox Enhancement which was supposed to do the following:

 

"Now instead of browsing only in the product's name or model name, this search box also by default searches through the product's description, returning more hits."

 

I installed it but it didn't work for me. I want users to be able to search through the product descriptions from the front page instead of having to go to "Advanced Search".

 

Thanks.

Share this post


Link to post
Share on other sites

Thanks. But I didn't have luck with it. Got an error. But I really didn't know where to place the code in my file.

 

I found something in the forums that addressed my question but didn't work either. This is the code I tried in the includes/boxes/search.php but that didn't work:

 

Basically I added

tep_draw_hidden_field('search_in_description', '1') .

into the page. The full code is below:

 

<?php

$boxHeading = BOX_HEADING_SEARCH;

$corner_left = 'square';

$corner_right = 'square';

$boxContent_attributes = ' align="center"';

 

$boxContent = tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get');

$boxContent .= tep_draw_hidden_field('search_in_description', '1') . 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) . '<br>' . BOX_SEARCH_TEXT . '<br><a href="' . tep_href_link(FILENAME_ADVANCED_SEARCH) . '"><b>' . BOX_SEARCH_ADVANCED_SEARCH . '</b></a>';

$boxContent .= '</form>' .

'<br><a href="' . tep_href_link(FILENAME_ALLPRODS, '', 'NONSSL') . '">' . BOX_INFORMATION_ALLPRODS . '</a><br>';

 

require(DIR_WS_TEMPLATES . TEMPLATENAME_BOX);

 

$boxContent_attributes = '';

?>

Share this post


Link to post
Share on other sites

Any idea what I'm doing wrong? Just trying to have the simple search be able to search through the product descriptions in addition to the product names.

Thanks

Share this post


Link to post
Share on other sites

Looking at the discussion Matt pointed to earlier I found that I could make one simple change to get the same results you're trying for (to have searches from the left column to default to searching descriptions and names). Below is what I changed [note: the only change I did was to add the tep_draw_hidden_field('search_in_description', '1') at the end of the line]:

 

Original:

'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) . '<br>' . BOX_SEARCH_TEXT . '<br><a href="' . tep_href_link(FILENAME_ADVANCED_SEARCH) . '"><b>' . BOX_SEARCH_ADVANCED_SEARCH . '</b></a>');

 

New:

'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) . '<br>' . BOX_SEARCH_TEXT . '<br><a href="' . tep_href_link(FILENAME_ADVANCED_SEARCH) . '"><b>' . BOX_SEARCH_ADVANCED_SEARCH . tep_draw_hidden_field('search_in_description', '1') . '</b></a>');

Share this post


Link to post
Share on other sites
Looking at the discussion Matt pointed to earlier I found that I could make one simple change to get the same results you're trying for (to have searches from the left column to default to searching descriptions and names). Below is what I changed [note: the only change I did was to add the tep_draw_hidden_field('search_in_description', '1') at the end of the line]:

 

Original:

'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) . '<br>' . BOX_SEARCH_TEXT . '<br><a href="' . tep_href_link(FILENAME_ADVANCED_SEARCH) . '"><b>' . BOX_SEARCH_ADVANCED_SEARCH . '</b></a>');

 

New:

'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) . '<br>' . BOX_SEARCH_TEXT . '<br><a href="' . tep_href_link(FILENAME_ADVANCED_SEARCH) . '"><b>' . BOX_SEARCH_ADVANCED_SEARCH . tep_draw_hidden_field('search_in_description', '1') . '</b></a>');

Just found this and it works perfectly. Thanks!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×