Store search box - search descriptions as well

Open to all! Ask other shopowners for help.
Post Reply
gsmiley007
Member
Posts: 82
Joined: Sun Mar 14, 2021 9:28 pm
Phoenix Version:
Has thanked: 9 times
Been thanked: 2 times

Store search box - search descriptions as well

Post 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


Join The Code Co-op to get access to your library in the Code Co-op Forum
raiwa
Certified Developer
Posts: 1640
Joined: Sat Dec 21, 2019 8:08 am
Phoenix Version: 1.1.0.6
Has thanked: 70 times
Been thanked: 152 times

Re: Store search box - search descriptions as well

Post 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') ?>
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
gsmiley007
Member
Posts: 82
Joined: Sun Mar 14, 2021 9:28 pm
Phoenix Version:
Has thanked: 9 times
Been thanked: 2 times

Re: Store search box - search descriptions as well

Post 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
raiwa
Certified Developer
Posts: 1640
Joined: Sat Dec 21, 2019 8:08 am
Phoenix Version: 1.1.0.6
Has thanked: 70 times
Been thanked: 152 times

Re: Store search box - search descriptions as well

Post 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.
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply