Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Search product description from initial searchbox?


Margo

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.

Link to comment
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 = '';

?>

Link to comment
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>');

Link to comment
Share on other sites

  • 3 years later...
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!

Link to comment
Share on other sites

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...