Override magento controller

Modifying magento core file is not at all good idea. All core files that we have modified will be smashed while magento upgrade.Magento have a feature to keep our custom code in local(app/code/local) folder. Inside that folder we can keep our custom codes safely.There are 2 way to override magento core module. Create same folder […]

Read More…

Delete single order in magento using SQL query

Here is the query to delete single order in magento. All we need to do is just replace ‘xxxxxxxxx’ with your order_id and run it in phpMyAdmin. It works fine in Magento 1.4.x and 1.7.x version. SET @orderId = ‘XXXXXXXXX’; #replace this WITH your ORDER NUMBERSET FOREIGN_KEY_CHECKS = 1;DELETE FROM sales_flat_order WHERE increment_id = @orderId;DELETE […]

Read More…

Turn off autocomplete in input fields

In some situations like in promotional code field on Cart page or username in Login page we may not want to show autocomplete below input field when we type some thing or double click on input fields. All we need to do is just add the autocomplete=’off’ attribute in input field.After entering this code, input […]

Read More…

Add tinyMCE editor in magento custom module

If we have created a custom module using Magento Module creator means, it will not contain ‘wysiwyg(tinyMCE)’ editor feature.We can add the ‘wysiwyg’ editor in custom module within 2 steps.Step 1:Add the following code in /controllers/Adminhtml/BlogController.php under the line $this->getLayout()->getBlock(‘head’)->setCanLoadExtJs(true). if (Mage::getSingleton(‘cms/wysiwyg_config’)->isEnabled()) { $this->getLayout()->getBlock(‘head’)->setCanLoadTinyMce(true);} Step 2:Add the following code in /Block/Adminhtml/Blog/Edit/Tab/Form.php file, within your field […]

Read More…

Add success or error message using magento session

Error message Set error message for front page. $message = $this->__(‘Got an error’);Mage::getSingleton(‘core/session’)->addError($message); Set error message for admin page. $message = $this->__(‘Got an error’);Mage::getSingleton(‘adminhtml/session’)->addError($message); Success message Set success message for front page. $message = $this->__(‘Got an error’);Mage::getSingleton(‘core/session’)->addSuccess($message); Set success message for admin page. $message = $this->__(‘Got an error’);Mage::getSingleton(‘adminhtml/session’)->addSuccess($message); If you are unable to view the […]

Read More…

jQuery setTimeout() function

If we want to run a block of code after a specified time means we can use jQuery setTimeout() method. What it will do is, it will run specified code at specified millisecond. Syntax for this method is setTimeout(code,milliseconds). jQuery(document).ready(function () { jQuery(‘.submit’).click(function(){ var T = setTimeout(showAlert, 3000); });});function showAlert(){ alert("Its fired after 3 seconds");} […]

Read More…