OpenCart: How to move search field to top menu (content_top.tpl)

Please read this article to learn how to easy move search field to another part of your page. In my case I will move it to my custom menu. First you need to copy the code for the search form from: /catalog/view/theme/-yourtheme-/template/common/header.tpl Code: <div id=”search”> <div class=”button-search”></div> <?php if ($filter_name) { ?> <input type=”text” name=”filter_name” … Read more

Twitter custom share button

Let your visitors share your content fast and easy by implementing your own twitter share button. Here’s how the code looks like: Code: <a href=” reading” title=”Click to share this post on Twitter”>Share on Twitter</a> Tip: Replace “Currently reading” with your own content and URL.

Detect left mouse button click with jQuery

This script below will detect left mouse click and pop up an alert when you left click on the link “Click me”. Code: <script> $(function(){ $(“#click-me”).live(‘click’, function(e) { if( e.button == 0 ) { // Clicked with left mouse button alert(‘You clicked with left mouse button’); } }); }); </script> <a id=”click-me”>Click me</a>

Disable enter key in a form


There are two simple ways to disable enter key in your forms. 1. The first one is a piece of javascript that you include in your head section. <script language=”JavaScript”>function disableEnterKey(e){var key;if(window.event)key = window.event.keyCode; //IEelsekey = e.which; //firefoxif(key == 13)return false;elsereturn true;} 2. Than in the form issue onKeyPress like this: <input type=”text” onkeypress=”return disableEnterKey(event)”> … Read more