Debugging tips & tricks with Magento Commerce


infirock

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.


Zend_Debug::dump

First off use Zend_Debug::dump($foo); instead of using var_dump($foo); orprint_r($foo); it is essentially the same, just a wrapper with pre HTML tag for formatting and escaping of special characters.

More details about :arrow: 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 thegetData() 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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s