Post by Pooleyy » Fri Feb 03, 2017 11:04 pm

How do I modify search.php so all of my searches look through descriptions too?

Basically, I just want the below box to be 'ticked' all the time, rather than me manually ticking it.
Image

https://postimg.org/image/ihre7tzw7/

There's a few old posts, I'm running OpenCart 2.0.1.1

Thanks

New member

Posts

Joined
Thu Oct 08, 2015 9:25 pm

Post by cyclops12 » Fri Feb 03, 2017 11:31 pm

You could edit catalog/view/theme/YOUR_THEME/template/product/search.tpl and find

Code: Select all

<label class="checkbox-inline">
          <?php if ($description) { ?>
          <input type="checkbox" name="description" value="1" id="description" checked="checked" />
          <?php } else { ?>
          <input type="checkbox" name="description" value="1" id="description" />
          <?php } ?>
          <?php echo $entry_description; ?></label>
And change it to

Code: Select all

<label class="checkbox-inline">
         
          <input type="checkbox" name="description" value="1" id="description" checked="checked" />
          
          <?php echo $entry_description; ?></label>

Expert Member

Posts

Joined
Sun Sep 27, 2015 1:10 am

Post by werwolf648 » Mon Nov 06, 2017 1:55 am

Following your advice, it changes the view only.
Search by descriptions still is not performed by default.

Newbie

Posts

Joined
Thu Jun 25, 2015 4:23 pm

Post by cyclops12 » Mon Nov 06, 2017 3:48 am

werwolf648 wrote:
Mon Nov 06, 2017 1:55 am
Following your advice, it changes the view only.
Search by descriptions still is not performed by default.
This works on my default 2.3.0.2

Expert Member

Posts

Joined
Sun Sep 27, 2015 1:10 am

Post by BillT » Sat Jan 08, 2022 12:08 am

If you want to have search in descriptions box checked all the time when doing search in opencart then you need to follow the instructions below ( ive tried and tested it and it works)

Modify the search.php for version 2 and less

Find the search.php file located in: catalog/controller/product/search.php
Locate this code below:
$filter_data = array(
'filter_name' => $search,
'filter_tag' => $tag,
'filter_description' => $description,
'filter_category_id' => $category_id,
'filter_sub_category' => $sub_category,
'sort' => $sort,
'order' => $order,
'start' => ($page - 1) * $limit,
'limit' => $limit
);

Change 'filter_description' => 'true',

Above is for Opencart ver 2
-----------------------------------------------------------------------------------------------------------------------------------
For Version 3 follow the instructions below

For Opencart version 3 ( I have this and I changed it to the below code and it worked . I see the check box in Search in product descriptions always when doing search )

change the code to below

'filter_description' => $description=1

Thats it and save. Please do make a backup copy of the code just in case but this works for me and i use Opencart 3.0.3.6 version

Newbie

Posts

Joined
Wed Dec 08, 2021 4:59 am

Post by dancinpony » Tue Sep 20, 2022 3:35 am

thanks this helped me worked using Oc 3.0.3.8

Newbie

Posts

Joined
Fri Jan 08, 2016 12:39 am

Post by trilevik » Tue Mar 28, 2023 4:32 pm

BillT wrote:
Sat Jan 08, 2022 12:08 am
For Opencart version 3 ( I have this and I changed it to the below code and it worked . I see the check box in Search in product descriptions always when doing search )

change the code to below

'filter_description' => $description=1
Thanks guys!
I made a quick ocmod extension that changes it to include description. Also, while I was at it, removed the need to check in seatrch from subcategories.
And removed the checkboxes + texts from twig files.
Posted the extension here:
https://www.opencart.com/index.php?rout ... n_id=44888

Cheers!

Newbie

Posts

Joined
Tue Mar 28, 2023 4:28 pm
Who is online

Users browsing this forum: No registered users and 66 guests