Developer Tips: How to Enable Prestashop CMS Search. Part 2

Aug 6, 2012119Alex Simonchik
Developer Tips: How to Enable Prestashop CMS Search. Part 2

Last Monday we have described how to enable PrestaShop CMS search. Today we will explore how to make this search more flexible and how to create module settings (remember, that we have already posted the module to enable PrestaShop CMS search).

Let’s start with updating the module to 2.0 version. To do that, change the $this->version = ‘2.0.0’ parameter in the module constructor. Now we need to write a module with function, similar to standard search in PrestaShop. Create two tables, belvg_cms_search_index and belvg_cms_search_word, to be used for articles indexation. Don’t forget to add the indexed flag, noting that the article is indexed.

In order to index an article while saving and updating articles, we change CMS class by extending the functionality of add () and update () methods:

indexation () method enters data about articles in index tables.

getArticlesToIndex () method returns a list of articles, needed to be indexed, or if the article identifier was transferred, it checks whether the article requires indexation. saveIndex () method is responsible for recording new indexes data in the database. SetArticlesAsIndexed () marks the indexed flag we created earlier in cms table.

Partner With Us Let's discuss how to grow your business. Get a Free Quote.
Talk to Igor

The most important is find () method, which selects articles by comparing the search query with words in the index table.

It’s time to create module settings.

To allow users to customize the module, you need to implement a getContent () method in the belvg_cmssearchfree.php file, which should return the html, containing a form with settings.

We use here smarty template modules/belvg_cmssearchfree/tpl/adm/content.tpl:

Download the full module version belvg_cmssearchfree. We are looking forward to your ideas and discussions in the comment form below.

Partner With Us Looking for a partner that will help you to grow your business? We are the right company to develop your webstore. Feel free to get in touch with us. We will be happy to discuss your business opportunities and provide you with a Free Quote. Talk to Igor


  1. On my it is not working.
    I think that problem is that module is not indexing my pages.
    When i am using reindex all button i am getting page just to path bar and then it is cut.
    Where is the problem laying?
    I am using

  2. Pawel,

    This problem has probably occurred because of incorrect module installation and/or configuration. Would you please send us on or via Live Chat tab FTP and admin accesses so that our developers could check out and fix your issue?

  3. Hi,
    very good and interesting developpement,
    but i have the same problem like Pawel !
    I use Prestashop

    Could you help me _

    Thanks very much


  4. Thomas,

    This module works only with Prestashop 1.4, but I am going to update it in the nearest future. So stay tuned!

  5. Elaine,

    Yes, we remember about this module. We will try to remake it this month since there are already
    several users who have been waiting for this.

  6. Is there already a solution for 1.5? Would be very nice.
    Sorry for bad english. I’m German …

  7. We have updated the CMS Search module for Prestashop 1.5. Head to our store to get it –

    But that’s not all – we will be offering the new version of the module for free to several blog readers who were interested in it’s appearance enough to ask us about it. If you wrote a comment to this post – please contact us at and we will give you a special download code.

Post a new comment

BelVG Newsletter
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
Email *