0

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.

2 Answers 2

2

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 );

1

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.

4
  • can you give me more information about that?
    – zekia
    Commented Nov 11, 2014 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! Commented Nov 11, 2014 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
    Commented Nov 11, 2014 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. Commented Nov 11, 2014 at 15:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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