Jump to content

Search facility trigger


Ckay

Recommended Posts

Hi and thanks in advance.

 

Currently, when a site user uses the "Product search" facility on our new Prestashop website, a list of the possible matches appears automatically after the user has typed out 3 characters. I've been asked to change this to 2 characters.

 

In the BO>Preferences>Search there is a field Labelled Minimum word length (in characters), which I changed to 2 and above that clicked on the option to Re-build the entire index. All in vain, it didn't make any difference.

 

I then located the following file  modules\blocksearch\blocksearch-instantsearch.tpl and located the following lines of code:

 

$input.autocomplete(
    '{if $search_ssl == 1}{$link->getPageLink('search', true)|addslashes}{else}{$link->getPageLink('search')|addslashes}{/if}',
    {
        minChars: 3,

 

I changed the minChars: 3, to 2 expecting this to do the trick. Unfortunately not.
 

Can anyone help me out on this?

Link to comment
Share on other sites

I've sorted this out if anyone is interested...

 

The above doesn't work for the instant search results, however it does work for 2 characters used as a search string viewed in a separate search page.

 

For the instant search to work with 2 characters I found the theme/<yourtheme>/js/modules/blocksearch/blocksearch.js contains the relevant code. (See below)

 

var width_ac_results =     $("#search_query_" + blocksearch_type).parent('form').width();

    if (typeof ajaxsearch != 'undefined' && ajaxsearch && typeof blocksearch_type !== 'undefined' && blocksearch_type)

        $("#search_query_" + blocksearch_type).autocomplete(

            search_url,

            {

                minChars: 2,

                max: 10,

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...