If you are new to Magento then the vast amount of code to digest can be quite overwhelming. However, here are some tips I’ve learned about over the past on some means to tear down Magento and figure out whats making it work.
First off use
Zend_Debug::dump($foo); instead of using
print_r($foo); it is essentially the same, just a wrapper with pre HTML tag for formatting and escaping of special characters.
More details about Zend Frameworks dump method.
However there will be times that simply dumping objects to the screen can be too much and cause browser hangups or even crashes. The best practice Ive learned is to always use the
getData() method that Magento has built-in to the Varient Object, this way your not getting redundant amounts of data dumped to the screen but only the bits you really care about.
Varien Object getData, debug
View original post 656 more words