I'm trying to change an extension's code, and I need to display some variable contents from code files (app/code/community/extension/block/file.php) in order to be able to track down the changes I make.

Is that possible? Cause using php "echo" in those files has no effect on website frontend.


You can add this line to dump this variable to the log file or even a custom log file as below. Mage::log($myvariable, null, 'mylog.log', true );


Your best, most complete solution is to get yourself setup with an IDE and xdebug. Adding echo's or writing to a log is rather long winded and clumsy in comparison.

  • can you give me more information about that? – zekia Nov 11 '14 at 13:26
  • Two popular IDE's are the free Netbeans and the paid PhpStorm - both are good options. You can find information about xdebug here and there are browser plugins such as this one to make integration easier. It takes a little bit of setting up, but once done you will wonder how you ever survived without break points! – Jonathan Hussey Nov 11 '14 at 13:37
  • It sounds nice but right now I don't have enough time to deal with all this. Is there some easier way to debug a few things? – zekia Nov 11 '14 at 14:53
  • I know it probably looks like the hard option right now, but it is the 'right' option. Spend a little time getting to grips with it and you will not be disappointed with the extra power it grants to debug your code. There's no easy workaround to get it working but once you are done you will see it's not nearly as hard as it may look right now. – Jonathan Hussey Nov 11 '14 at 15:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.