Skip to content

Instantly share code, notes, and snippets.

@krabello
Forked from roundgirl/gist:1b7e385baa1f8458eb16
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save krabello/78117d8112f85023e1a2 to your computer and use it in GitHub Desktop.
Save krabello/78117d8112f85023e1a2 to your computer and use it in GitHub Desktop.
<div class=searchBox>
<img onclick=moduleSearch('<?php catalog();?>'); src=images/026cc599.search_icon.png alt=Search>
<input id="filter_keyword" placeholder=Keyword/Item#>
</div>
<script>
<!--
$('#filter_keyword').keydown(function(e) {
if (e.keyCode == 13) {
moduleSearch('<?php echo $url?>');
}
}).focus(function() {
if ($(this).val() == 'Keyword/Item#') {
$(this).val('');
}
});
function moduleSearch(url) {
var searchTerm = document.getElementById('filter_keyword').value;
if (searchTerm === "") {
return false;
}
var searchLocation = url + 'index.php?route=product/search&keyword=' + encodeURIComponent(searchTerm);
window.location = searchLocation;
}
//-->
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment