Recent Posts


Can’t echo a Child Block?


Frustrated by Magento? Then you’ll love Commerce Bug, the must have debugging extension for anyone using Magento. Whether you’re just starting out or you’re a seasoned pro, Commerce Bug will save you and your team hours everyday. Grab a copy and start working with Magento instead of against it.

Updated for Magento 2! No Frills Magento Layout is the only Magento front end book you'll ever need. Get your copy today!

If you’re having trouble with a call like

echo $this->getChildHtml('foo');

returning an empty string, add the following debug code to your template


This will print out all the children of the current block. If you don’t see the block you’re trying to echo above, that means your block (foo above) isn’t being correctly added to the current block. Check the your custom layout xml for subtle errors (missing name, type, etc.)

Copyright © Alan Storm 1975 – 2022 All Rights Reserved

Originally Posted: 24th April 2012