Jump to content

How to personnalise field search


Recommended Posts

Hi all and first sorry for my poor English,

 

With the following code i would like to add the word "search" in the search field of Prestashop.

 

<input id="searchbox" type="text" onblur="if (this.value == '') {this.value = 'Rechercher';}" onfocus="if (this.value == 'Rechercher') {this.value = '';}" name="s" value="Search">

 

When focus is placed in the search field, Search word disapears and it (generally) works fine.

 

But if this code is added to Prestashop code, i get a blank page...

 

Does anybody have a suggestion ?

 

Regards

Link to comment
Share on other sites

Changes the way Search block works - when you click in text box, Search... auto hides

 

modules/blocksearch/blocksearch-top.tpl

 

 

Change this

 

<input class="search_query" type="text" id="search_query_top" name="search_query" value="{if isset($smarty.get.search_query)}{$smarty.get.search_query|htmlentities:$ENT_QUOTES:'utf-8'|stripslashes}{/if}" />

 

 

To this

 

<input class="search_query" type="text" id="search_query_top" name="search_query" value="{if isset($smarty.get.search_query)}{$smarty.get.search_query|htmlentities:$ENT_QUOTES:'utf-8'|stripslashes}{else}{l s='Search entire store...' mod='blocksearch'}{/if}" onfocus="if(this.value=='{l s='Search entire store...' mod='blocksearch'}')this.value='';" onblur="if(this.value=='')this.value='{l s='Search entire store...' mod='blocksearch'}';" />

 

You can change the value in red to your liking...

  • Like 3
Link to comment
Share on other sites

  • 11 months later...

Hi tdr170,

thank you very much for your solution, it works for me too!!!

 

I need one more information: since I have a multilanguage shop is it possible to change the text in the field search according with the selected language?

 

Thank you in advance,

Regards

Miriam

Link to comment
Share on other sites

×
×
  • Create New...