A very good friend of mine, a JAVA coder, once told me.
“When I started coding, all I focused on, was learning how to DEBUG properly – I wanted to KNOW what was happening there.”
This is probably the best advice I can offer someone new to Development. Learn how to debug your code from day one, so that you’ll have a clear idea of what your code is doing.
Now, working with Magento you’ll need to know how to debug your code.
Of course you can use the old faithful
print_r($variable); var_dump($variable);
However, Magento objects are often times very large, and the output will be painful to understand and read.
However, there is a better way.
Install FireFox, and add the extensions
Then install the excellent Magento Debug Module by netresearch
Log into the Magento Admin Backend, and navigate to System->Configuration->Developers Options
Enable the Debug module.
Now in your Magento Code, when you want to debug a variable, add the following
Mage::Helper('debug')->log($variable);
Open the FireBUG console and reload the page, and you’ll see a collapsible output of your object
Tags: Debug, Development, Magento, Zend




