Skip to content

Instantly share code, notes, and snippets.

@roundgirl
Last active August 29, 2015 14:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save roundgirl/1b7e385baa1f8458eb16 to your computer and use it in GitHub Desktop.
Save roundgirl/1b7e385baa1f8458eb16 to your computer and use it in GitHub Desktop.
Search-CSI
<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