When you search in Magento, on search result page you will see the results with below text for example,
Search results for 'configure'
Here my search keyword is configure.
How can I highlight the searched keyword on results page ?
Thanks
That can be found in app\design\frontend\base\default\template\catalogsearch\result.phtml. So create a local copy of that file in your theme and add some code/CSS to highlight your search term.
The code will look like that:
<h1><?php echo ($this->getHeaderText() || $this->getHeaderText() === false) ? $this->getHeaderText() : $this->__("Search results for '%s'", $this->helper('catalogsearch')->getEscapedQueryText()) ?></h1>
The search term itself comes from:
$this->helper('catalogsearch')->getEscapedQueryText()
So you can take that out and add some element around it with a class or id. After that add a style for that class or id, something like:
.yourGivenClass {
background-color: yellow;
padding: 5px;
}
That should be it.
Regards
<span class="yourGivenClass">$term</span>
. That should do it.
Commented
May 5, 2014 at 11:53