Search in product descriptions by default

Many visitors of E-commerce websites use the search to find something of interest and if they spell the keywords wrong the search results will often return a blank result page. Moreover, the default OpenCart search doesn’t look within the product description unless you check the box to do so. But what if I want this to be active as default option? Learn how to activate search in product descriptions by default in OpenCart

The search engine in OpenCart is fairly simple and by default it searches only by the product name. Once you get the search results page you get the option to search further within product description and subcategories if you like to.

Since it is not good practise for the customers to get blank search results page it is cool to activate the option search in product descriptions by default. In my case this is the trick I used on OpenCart version

1. Modify the search.php

Find the search.php file located in: catalog/controller/product/search.php
Locate the code:

$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 the line filter_description to:

'filter_description'  => 'true',

Save and upload the file back to the server and you are done!

In case you are using some third-party extensions/modules and you don’t see the changes you just made in search.php file then proceed to next step.

2. Modify the search.php

For those who are using extensions or custom themes which have done some modifications to default search.php file then the previous step 1 needs to be done also in the same file but on different location:


Modify the code as described in step 1, save and upload the file to server and you’re done!

Known issues

In newer versions of OpenCart the true setting may not do the trick. Then you should try the following:

'filter_description'  => $description=1


Leave a Reply

  1. Andrzej · April 19, 2017

    Thank you. It was very helpful but ‘true’ don’t working. $description=1 is OK.

    • janoshke · April 19, 2017

      Good. You found another workaround. Thanks for sharing this. May I ask what OC version you are using?

  2. Sjonnie · April 19, 2017

    Excellent! The $description=1 works flawlessly on my OC! Thanks!

  3. JohnyBuka · April 19

    Thanks! It’ work! Iam using (‘true’ version) You are BIG! 🙂