Jul 12, 2012

Magento: Get rid of admin notifications pop-up

Ever annoyed by the notification which pops up everytime you login to your Magento admin panel? Well, you can get rid of those bugging notifications without changing core.

Just disable the output of Mage_AdminNotification at:
System -> Configuration -> Advanced -> Disable Modules Output

Now logout and login, you will now never see those unwanted notifications.


Jul 12, 2012

Magento: Image resize/compression reduces quality of JPEG

In Magento, image quality is distorted when it’s resized in Category page as well as Product page. This is very bad if you are running an eCommerce website because image is the only thing which gives best impression to your customers. There are several complains regarding this in Magento forums with different answers. Some even suggest to use ImageMagick over the default Gd2 library.

If you don’t want to switch to ImageMagick and also don’t want to do much changes, here is a simple solution.

1.) Copy app/code/core/Mage/Catalog/Helper/Image.php
2.) Paste it in local (app/code/local/ , create directories Mage/Catalog/Helper if it’s not there)
So the final structure will be app/code/local/Mage/Catalog/Helper/Image.php
3.) Edit newly pasted Image.php’s init() method, just after it sets “watermark size”, add a line:


4.) Save, flush image cache, run any category or product page and see the difference!

Hope this helps!

Apr 21, 2012

Magento: Difference between order states and statuses

If you are building website in Magento, you may have noticed that there are two columns in sales_flat_order table which are confusing. These are state and status. You might think what is the difference between these two, both having same meaning.

Well, this is not the case. They both are different. State is used by magento to tell if the order is new, processing, complete, holded, closed, canceled, etc.; while Statuses are the one that YOU would be defining at the backend in System -> Order Statuses. Magento displays order STATUSES and not STATES in the backend order detail page to let you know which status is assigned as per your mapping. Remember, multiple statuses can be mapped with one state, while vice versa is not possible. Continue reading »

Apr 18, 2012

Magento: Get sentence case from camel case string

Magento has pre-defined methods for getters and setters which will convert camelcase string to underscore formatted string.
Example, Magento will convert thisIsDummy to this_is_dummy using it’s method _underscore which is available at Varien_Object class.

If you want to convert Camel case string to Sentence case (this may sound weird, but we got the requirement),
Example, from thisIsDummy to This Is Dummy, below method will help you to do so:

public function camelToSentence($word) {
            if(isset($word)) {
                $result = ucwords(preg_replace('/(.)([A-Z])/', "$1 $2", $word));
                return $result;
Apr 15, 2012

Magento: Difference between source_model, frontend_model, backend_model

When dealing with Magento Admin’s system configuration, you may have encountered with these models. If you don’t know, these models are used when you add custom fields through your system.xml file at Magento’s backend configuration (Admin -> System -> Configuration).

Okay, so the difference between these 3 models are:

It specifies a Model class, where you will be returned with options that can populate in the current field.



this will populate select dropdown with values Yes/No

It specifies a Block class to add custom render to use as a frontend field type instead of/along with default frontend_type field value (text, textarea, select, etc.).

Example, Continue reading »

Welcome to my Blog

Kalpesh MehtaHelping Magento developers in their day-to-day development problems since 2011. Most of the problems and solutions here are my own experiences while working on different projects. Enjoy the blog and don't forget to throw comments and likes/+1's/tweets on posts you like. Thanks for visiting!