Created
October 3, 2013 05:11
-
-
Save wcodex/6805282 to your computer and use it in GitHub Desktop.
How to add and customize the search box in Magento
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Available at [your-theme]/template/categorysearch/form.mini.phtml | |
<?php | |
$catalogSearchHelper = $this->helper('catalogsearch'); | |
?> | |
<form id="search_mini_form" action="<?php echo $catalogSearchHelper->getResultUrl() ?>" method="get"> | |
<div class="form-search"> | |
<div class="container"> | |
<input id="search" type="text" name="<?php echo $catalogSearchHelper->getQueryParamName() ?>" value="<?php echo $catalogSearchHelper->getEscapedQueryText() ?>" class="blink" maxlength="<?php echo $catalogSearchHelper->getMaxQueryLength();?>" /> | |
</div> | |
<button type="submit" title="<?php echo $this->__('Search') ?>" class="search-button"><span><span><?php echo $this->__('Search') ?></span></span></button> | |
<div id="search_autocomplete" class="search-autocomplete"></div> | |
<script type="text/javascript"> | |
//<![CDATA[ | |
var searchForm = new Varien.searchForm('search_mini_form', 'search', '<?php echo $this->__('Search entire store here...') ?>'); | |
searchForm.initAutocomplete('<?php echo $catalogSearchHelper->getSuggestUrl() ?>', 'search_autocomplete'); | |
//]]> | |
</script> | |
</div> | |
</form |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Code to add search box | |
<?php echo $this->getChildHtml('topSearch') ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment