Page 1 of 1

Store search box - search descriptions as well

Posted: Thu Jan 27, 2022 4:36 pm
by gsmiley007
Just wondering if it's possible to configure the search box to search for key words in the description as well and not just titles.

Thanks

Re: Store search box - search descriptions as well

Posted: Thu Jan 27, 2022 5:35 pm
by raiwa
Make a copy of the search module template file and put it in the override template folder.
Then change line 2 in this copy to:

Code: Select all

  <?= tep_draw_form('quick_find', tep_href_link('advanced_search_result.php', '', $GLOBALS['request_type'], false), 'get', '') . tep_draw_hidden_field('search_in_description', '1') . tep_hide_session_id(); ?>
Note that the code is still the old version. In future updates you should modernize it following the core module coding. It will look similar like in the advanced search page line 86:

Code: Select all

<?= (new Form('advanced_search', $Linker->build('advanced_search_result.php', [], false), 'get', ['onsubmit' => 'return check_form(this);']))->hide_session_id()->hide('search_in_description', '1') ?>

Re: Store search box - search descriptions as well

Posted: Thu Jan 27, 2022 11:37 pm
by gsmiley007
@raiwa

Do you mean this file to change: includes/modules/boxes/templates/tpl_bm_search.php

Also do I put this file here: templates/override/includes ?

Thanks

Re: Store search box - search descriptions as well

Posted: Fri Jan 28, 2022 8:20 am
by raiwa
I was referring to the header module.
In the box module it's even easier. The code is already in: bm_search.php
line 19 change to:

Code: Select all

      $form->hide_session_id()->hide('search_in_description', '1');
As it's the main module, you can't use a copy in templates/override. Change the original file, it's just a setting.