1
votes

Perhaps this question has been asked before but I cannot find it anywhere. I am a newbie on Magento/Netbeans.

After setting up xdebug in Netbeans, I was able to start debugging by stopping at a line in index.php, say, for this line:

Mage::run($mageRunCode, $mageRunType);

Where I can check the values of $mageRunCode and $mageRunType.

However, after setting up a breakpoint in a .phtml file, the process runs through the breakpoint without stopping at it. For example, in the file \default\template\catalog\product\list.phtml, I set a breakpoint at (I want to step into getPriceHtml() function):

<?php echo $this->getPriceHtml($_product, true); ?>

I even set some breakpoints in the function

public function getPriceHtml($product, $displayMinimalPrice = false, $idSuffix = '')

in Abstract.php, but it did not stop either.

So, what do I need to do to have the debug process stop at any breakpoints in Netbeans with XDebug?

1
I started using Step-Over to proceed debugging in Magento. It turned out the debugging process actually exited at the function: protected function _checkBaseUrl($request) {... exit;} before the webpage got displayed. So, is it true that it is impossible to step through codes for any .phtml template files in Magento with or without NetBeans? - umage

1 Answers

1
votes

It is possible to stop at breakpoints in phtml files, I do it all the time.
What could be happening, is that the code where you put the breakpoint is not executed. The list.phtml file, manages both the grid and the list view modes: maybe you put the breakpoint in the grid part and were watching the list view, or vice versa. Or maybe you're not in the right template: to be sure, enable the template hints and check the path of the file.
As for the Mage_Catalog_Block_Product_Abstract::getPriceHtml() maybe it is overriden by some other class.

My advice, for the list.phtml file (when you are sure it's the correct one, cfr template hints), is to put a breakpoint at the first php line, in version 1.7.0.2's native file it would be line 35:

$_productCollection=$this->getLoadedProductCollection();

and when you get there use the "Step Over (F8)" function until you reach the line you want to examine, ie <?php echo $this->getPriceHtml($_product, true) ?>, and there you can "Step Into (F7)" it and you will get directly to the actual function.

HTH