Get Free Audit

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

Aug 6, 2012

845 Alex 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.


support_prestashop

PrestaShop Support & Maintenance

Take your online store to the next level with BelVG PrestaShop Support & Maintenance

Visit the page

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.

Igor Dragun
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.

Igor Dragun

Partner With Us

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

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.

development_prestashop

Dedicated PrestaShop Developers

Take your online store to the next level with BelVG Dedicated PrestaShop Developers

Visit the page
Igor Dragun
Partner With Us Looking for a partner to grow your business? We are the right company to bring your webstore to success. Talk to Igor

13 Comments

  1. We have updated the CMS Search module for Prestashop 1.5. Head to our store to get it – http://module-presta.com/cms-search.html.

    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 [email protected] and we will give you a special download code.

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

  3. 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.

  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. Hi,
    very good and interesting developpement,
    but i have the same problem like Pawel !
    I use Prestashop 1.4.4.1

    Could you help me _

    Thanks very much

    Pierre

  6. Pawel,

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

  7. 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 1.4.4.1

Post a new comment

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