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…

Update order status programmatically in magento

We can update order status of product in magento by using this below code. setState() function will do this for us, all we need is just pass the required arguments like state to be updated, status of the state, comment for the status change. $order = Mage::getModel(‘sales/order’)->loadByIncrementId($orderId); $state = ‘new’;$status = ‘label_generated_by_user’;$comment = ‘You have […]

Read More…

Clear form fields after finishing ajax submit using Jquery

Use reset() method to clear form fields after submitting the form via ajax. $.ajax({ type:"POST", url:formUrl, data:formData, beforeSend:function(){ $(‘.status’).html(‘<b>Form is being submitted</b>’); }, success:function(data){ $(‘. status ‘).html(‘<b>Thank you!! We have received your form</b>’); }, complete:function(){ $(‘#form-id’).each(function(){ this.reset(); //Here form fields will be cleared. }); }});

Read More…