Figured this out: <input type=”text” id=”txtSearch” onkeypress=”return searchKeyPress(event);” /> <input type=”button” id=”btnSearch” Value=”Search” onclick=”doSomething();” /> <script> function searchKeyPress(e) { // look for window.event in case event isn’t passed in e = e || window.event; if (e.keyCode == 13) { document.getElementById(‘btnSearch’).click(); return false; } return true; } </script>
Search the Wiki
Hiding empty attribute on front-end
For some odd reason, the Magento developers decided that an empty attribute should NOT be empty, but rather “No” or “N/A”, depending on its type. This is not just annoying, but in some cases can display wrong information which means confused visitors and potentially lost sales. Fortunately, there is a quick fix that will solve Full Article…
Redirecting to the last page after customer login magento
On a current project, I had a requirement to redirect to the homepage once a user successfully logs in to their account. I tried a few plugins to no avail, so had a go doing it myself. Obviously Magento by default, redirects to the customers Account page although there is a setting in the admin Full Article…
Getting selected simple product id in configurable product on client side.
If you need to get id of selected simple product in configurable product on client side you can do it in many different ways. Here is simple function how to achieve that with no code modification, new templates or even modules. Just one Javascript file and layout update. Product.Config.prototype.getIdOfSelectedProduct = function() { var existingProducts = Full Article…
Magento : Get Store Id, website Id, website info
After hours of searching on Google, i find out some ways to get Store and Website info 🙂 Get current store:       Mage::app()->getStore(); Get current store Id: Mage::app()->getStore()->getId(); Get current website Id: $storeId = Mage::app()->getStore()->getId(); Mage::getModel(‘core/store’)->load( $storeId )->getWebsiteId(); Get store info by store code: $storeCode = “your_store_code”; Mage::getModel( “core/store” )->load( $storeCode ); Get website info Full Article…
How to remove all the different CSS and JS in skin or js folder by XML
How to remove all the different CSS and JS in skin or js folder? —————————— Here is what you need to do: <reference name=”head”> <!– For a JS in the js folder –> <action method=”removeItem”><type>js</type><name>functions.js</name></action> <!– For a JS in the skin folder –> <action method=”removeItem”><type>skin_js</type><name>functions.js</name></action> <!– For CSS in the skin folder –> <action Full Article…
How to prevent web access your version control on server
Version control systems/platforms such as Git and Subversion store their metadata in hidden folders. When left open via the web, they could reveal sensitive information such as passwords. This holds true even when directory listing is disabled. ————————————— Solution: RedirectMatch 404 /\.git You need to add the above line into your .htaccess or your server Full Article…
How to fetch complete customer data in magento
I need to fetch whole customer data from mysql by query. I need to get data by entity_id. Please help ——————————– Answer: Here is what you can do. Activate the sql query log. Edit /lib/Varien/Db/Adapter/Pdo/Mysql.php and set the values for $_debug and $_logAllQueriesto true. then create a custom script that just calls $customerId = Full Article…
Custom configuration of Amazon RDS instances
Amazon RDS instances are convenient and scalable. However, whilst running long-running workflows with large datasets, the servers can come under considerable strain at times. Sometimes, we have noticed that certain transactions return with an error – not because something is wrong with the transaction syntax, rather that the MySQL server believes that the transaction is Full Article…
Setting Up Git on Windows in Four Easy Steps
Introduction Setting up Git can be intimidating, especially for those that are trying a version control system for the first time or moving from Subversion. It use to be the case that Git was a huge hassle to install and use on Windows. However, today it’s very easy to use Git on Windows either through Full Article…