Debugging magento

Debugging in Magento

You probably already have PHP Storm and xdebug running to debug Magento. If not see computer_apps_accounts_installation_setup.

There are more tools and settings that help you to debug Magento.

One of those tools what may come handy is alternate template hints module called Aoe_TemplateHints by Fabrizio Branca. iec-mod-import Aoe_TemplateHints

Firefox add-on

These add-ons work in Linux, Mac, Windows.

“easy xdebug” let you start a xdebug-session.

“Firebug” let you see everything that happens on the client side in the web browser.

Admin settings

In Admin – > System -> Configuration -> Developer you find settings for Profiler and Logging.

Change “Current configuration scope” on the upper left to get more debug settings for each scope.

Settings “Template Path Hints” and “Add Block Names to Hints” show you the name of each block the page is built from.

Developer mode

Magento can be set into Developer mode. This means that you can se more error messages that is normally hidden.

If you look at Index.php you find the following:

if (isset($_SERVER[‘MAGE_IS_DEVELOPER_MODE’])) {

    Mage::setIsDeveloperMode(true);

}

This code checks the MAGE_IS_DEVELOPER_MODE environment variable in Apache.

You can activate this variable in your local MAMP-installation, and you can get all messages.

See this page: magento_developer_mode

Observe: Developer mode affect the translations.

Normal is 1. Inline, 2. Site tranlate.csv, 3. module translation, 4. the string in the template

With developer mode you get 3 and 4.

Source

Logging

You can send a string to a log file and then look in that file.

How to use Mage::log()

HowTo: Quick and dirty file logging

More about logging here:

Magento debugging tips

Turn off e-mail

A lot of things you do on your offline site can generate an e-mail.

Turn off e-mail during test: Turn off transactional email in Magento

If you want to test emails then you can use Vaimo_Smtp to rediect the emails to your email account.

Turn off Payment methods

Magento can immediately without warning send an invoice to Klarna if you click on “Capture” on an order.

Deactivate payment methods in Admin -> System -> Configuration -> Sales -> Payment methods

Klarna and DIBS have a special “test mode” that allow you to test without creating any real payment.

See the test accounts here : clone_site

If you need credit cards to test DIBS with, you find them here Dibs.dk

Paypal sandbox

You can test your paypal by following the instructions for developers. Paypal have a full sandbox.

Developer page

Sandbox page

For Paypal you need to surf into the paypal and log in to get the test account.

  • Username: info@icommerce.se
  • Password: You need to ask David for that.

Or you can create your own test account. It is free. See How to Configure and Test PayPal in Magento.

= Remote debugging

Ordered List ItemSetup xdebug on server.

Reversed ssh tunnel.

ssh -R 9000:127.0.0.1:9000 <serverip>

Listen on port 9000 in phpstorm.

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