Jamie Gordon Posted November 10, 2010 Share Posted November 10, 2010 Hi all,Just wondering how I can add some default text in the search bar at the top of the default PrestaShop template?I am creating an ink site and I would like users to type in the make/model of their printer so that they can find the correct products for their printer.Could someone please point me in the right direction? I would love to have the following text: "Enter Printer Make/Model" instead of the search bar being blank.Thanks in advance,JAMiE Link to comment Share on other sites More sharing options...
rocky Posted November 11, 2010 Share Posted November 11, 2010 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 : 1 Link to comment Share on other sites More sharing options...
noesac Posted November 11, 2010 Share Posted November 11, 2010 Hi Rocky I think you're missing something at the end? Link to comment Share on other sites More sharing options...
rocky Posted November 11, 2010 Share Posted November 11, 2010 I can't see anything missing. The code works on my test site. Link to comment Share on other sites More sharing options...
noesac Posted November 11, 2010 Share Posted November 11, 2010 Ah my mistake, when you said "Change [removed] to javascript followed by : " I thought there was supposed to be code after the semi colon:) Link to comment Share on other sites More sharing options...
Jamie Gordon Posted November 12, 2010 Author Share Posted November 12, 2010 Hey thanks for that, I really appreciate your help.I've successfully edited the code.Thanks again,Jamie Link to comment Share on other sites More sharing options...
Ash.Krish Posted November 12, 2010 Share Posted November 12, 2010 thnks rocky....i too searching this....thanks too jamie gordon....working grt man :-)cheers guys.... Link to comment Share on other sites More sharing options...
reinoplantae Posted April 3, 2012 Share Posted April 3, 2012 it didn't work in ps 1.4.6.2 Link to comment Share on other sites More sharing options...
reinoplantae Posted April 3, 2012 Share Posted April 3, 2012 my bad.... it does work! Link to comment Share on other sites More sharing options...
gabriel1804 Posted June 1, 2012 Share Posted June 1, 2012 Thank you Rocky. Two more questions: How to prevent user from searching the default text (Prevent from text "No results found for your search 'Enter search keywords'". It must be: "Please type a search keyword"). I have to edit search.tpl but I don't know how. How do I change the text color on the onblur element? I want the Default text with a certain color and another text color (the default shop text color for forms) when the user type text. Thank you. Link to comment Share on other sites More sharing options...
vero20 Posted August 1, 2012 Share Posted August 1, 2012 (edited) Works! Edited August 2, 2012 by vero20 (see edit history) Link to comment Share on other sites More sharing options...
PanMS Posted May 18, 2013 Share Posted May 18, 2013 Hi, everybody. Please, tell me what exactly should be put instead of [removed]. I cant understand where to get this JAVA script. Link to comment Share on other sites More sharing options...
vekia Posted May 18, 2013 Share Posted May 18, 2013 Hi, everybody. Please, tell me what exactly should be put instead of [removed]. I cant understand where to get this JAVA script. hello i suggest you to create new thread with your question. Please give us also more information in your new thread what you exactly expect regards Link to comment Share on other sites More sharing options...
adelnaser Posted September 22, 2013 Share Posted September 22, 2013 (edited) Im new to this and maybe I didnt understand this "Change [removed] to javascript followed by :" but it doesnt work for me . ps version 1.5.4.1 edit: it works but check the screen on how it modifies my search box.. it makes it small and ugly..can it be fixed? Edited September 22, 2013 by adelnaser (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted September 23, 2013 Share Posted September 23, 2013 it's related to the css, if i were you - will reinstall the module Link to comment Share on other sites More sharing options...
defuzed Posted September 30, 2013 Share Posted September 30, 2013 i realize this thread is pretty old, but if anyone stumbles upon it, the preferred solution for default text in form type inputs nowadays is the "placeholder" attribute. So something like: <input type="text" id="search_query" name="search_query" placeholder="Search Products ..." > Doesn't work with old IE versions, but theres a jquery plugin to make that work if you support old IE. 1 Link to comment Share on other sites More sharing options...
vekia Posted September 30, 2013 Share Posted September 30, 2013 hello this tutorial is related to old prestashop version. it isn't actual anymore. im closing this topic. If you're interested in modification for prestashop 1.5 - please create new thread with regards, Milos Link to comment Share on other sites More sharing options...
Recommended Posts