PanMS Posted May 19, 2013 Share Posted May 19, 2013 (edited) Hello everybody. I need to put default text like "enter key words here" in the search bar of blocktopmenu in Prestashop 1.5. There was a thread where this problem was solved by Rocky for header search bar like this: Change line 8 of modules/blocksearch/blocksearch-top.tpl (and blocksearch.tpl) from: <input type="text" id="search_query" name="search_query" value="{if isset($smarty.get.search_query)}{$smarty.get.search_query|htmlentities:$ENT_QUOTES:'utf-8'|stripslashes}{/if}" /> to: <input type="text" id="search_query" name="search_query" value="{if isset($smarty.get.search_query)}{$smarty.get.search_query|htmlentities:$ENT_QUOTES:'utf-8'|stripslashes}{else}{l s='Enter Printer Make/Model' mod='blocksearch'}{/if}" onfocus="[removed]if(this.value=='{l s='Enter Printer Make/Model' mod='blocksearch'}')this.value='';" onblur="[removed]if(this.value=='')this.value='{l s='Enter Printer Make/Model' mod='blocksearch'}';" /> Change [removed] to javascript followed by : This code is similar for the blocktopmenu search bar, so it had to work. But I can not find what did Rocky mean by "Change [removed] to javascript followed by :", because without this change the default text does not desapear from the search bar. So please tell me, where is this javascript code that should be put instead of [removed] in Prestashop 1.5? Edited May 19, 2013 by vekia (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted May 19, 2013 Share Posted May 19, 2013 just remove the [removed] will work :-) Link to comment Share on other sites More sharing options...
PanMS Posted May 19, 2013 Author Share Posted May 19, 2013 (edited) Thanks, Vekia! It is that simple) Edited May 19, 2013 by PanMS (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted May 19, 2013 Share Posted May 19, 2013 you're welcome i marked this thread as solved regars Link to comment Share on other sites More sharing options...
Sprenzy Posted August 28, 2013 Share Posted August 28, 2013 Apologies for posting on a solved thread... I would just like to know if it is possible to make the search field go blank again after you click into the search field? Link to comment Share on other sites More sharing options...
Sprenzy Posted November 19, 2013 Share Posted November 19, 2013 Anyone? Please, i'm desperate..... Link to comment Share on other sites More sharing options...
vekia Posted November 19, 2013 Share Posted November 19, 2013 just empty the value="" field, then word that you use will disappear from search field Link to comment Share on other sites More sharing options...
pietror1993 Posted April 12, 2014 Share Posted April 12, 2014 PrestaShop version: 1.5.4.1 hello guys I tried to add default text on my search box the way it sais on this forum but it is not working. this is my site www.dmadvertise.com this is the code you guys provided: <input type="text" id="search_query" name="search_query" value="{if isset($smarty.get.search_query)}{$smarty.get.search_query|htmlentities:$ENT_QUOTES:'utf-8'|stripslashes}{else}{l s='Enter Printer Make/Model' mod='blocksearch'}{/if}" onfocus="[removed]if(this.value=='{l s='Enter Printer Make/Model' mod='blocksearch'}')this.value='';" onblur="[removed]if(this.value=='')this.value='{l s='Enter Printer Make/Model' mod='blocksearch'}';" /> 1. do I have to erase both [removed] in order to work? 2. do I have to erase the blue text in order for the default text to disappear when someone searches for a product? 3. this is the default blocksearch-top.tpl file. where exactly is line 8? {* * 2007-2013 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <[email protected]> * @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} <!-- block seach mobile --> {if isset($hook_mobile)} <div class="input_search" data-role="fieldcontain"> <form method="get" action="{$link->getPageLink('search')}" id="searchbox"> <input type="hidden" name="controller" value="search" /> <input type="hidden" name="orderby" value="position" /> <input type="hidden" name="orderway" value="desc" /> <input class="search_query" type="search" id="search_query_top" name="search_query" placeholder="{l s='Search' mod='blocksearch'}" value="{if isset($smarty.get.search_query)}{$smarty.get.search_query|htmlentities:$ENT_QUOTES:'utf-8'|stripslashes}{/if}" /> </form> </div> {else} <!-- Block search module TOP --> <div id="search_block_top"> <form method="get" action="{$link->getPageLink('search')}" id="searchbox"> <p> <label for="search_query_top"><!-- image on background --></label> <input type="hidden" name="controller" value="search" /> <input type="hidden" name="orderby" value="position" /> <input type="hidden" name="orderway" value="desc" /> <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}" /> <input type="submit" name="submit_search" value="{l s='Search' mod='blocksearch'}" class="button" /> </p> </form> </div> {include file="$self/blocksearch-instantsearch.tpl"} {/if} <!-- /Block search module TOP --> 4. this is the default blocksearch.tpl file. where do I have to insert the code? {* * 2007-2013 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <[email protected]> * @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} <!-- Block search module --> <div id="search_block_left" class="block exclusive"> <h4 class="title_block">{l s='Search' mod='blocksearch'}</h4> <form method="get" action="{$link->getPageLink('search', true)}" id="searchbox"> <p class="block_content"> <label for="search_query_block">{l s='Enter a product name or description.' mod='blocksearch'}</label> <input type="hidden" name="orderby" value="position" /> <input type="hidden" name="controller" value="search" /> <input type="hidden" name="orderway" value="desc" /> <input class="search_query" type="text" id="search_query_block" name="search_query" value="{if isset($smarty.get.search_query)}{$smarty.get.search_query|htmlentities:$ENT_QUOTES:'utf-8'|stripslashes}{/if}" /> <input type="submit" id="search_button" class="button_mini" value="{l s='Go!' mod='blocksearch'}" /> </p> </form> </div> {include file="$self/blocksearch-instantsearch.tpl"} <!-- /Block search module --> Link to comment Share on other sites More sharing options...
AggelosG Posted December 30, 2016 Share Posted December 30, 2016 Hi! How can I make the default word 'Search' disappear from the search bar as soon as I put the cursor in to type? Thanks in advance Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now