Magento Layout Update – Unable to Add a Child Block in Layout XML by Reference

layoutlayout-update

I'm having a problem where I can't seem to add a child block in a layout XML file. What am I doing wrong in mylayout.xml that I can't load abc? I have the following files.

onestepcheckout.xml

<onestepcheckout_index_index>
    ...
    <reference name="content">
        <block type="onestepcheckout/checkout" name="onestepcheckout.checkout" template="onestepcheckout/checkout.phtml">
            ...
            <!-- this child block can be loaded -->
             <block type="block/class" template="path/to/template/template.phtml" name="qwe" as="qwe" />
            ...
        </block>
    </reference>
    ...
</onestepcheckout_index_index>

mylayout.xml

<onestepcheckout_index_index>
    <reference name="onestepcheckout.checkout">
        <!-- this child block can not be loaded -->
        <block type="block/class" template="path/to/template/template.phtml" name="abc" as="abc" />
    </reference>
</onestepcheckout_index_index>

checkout.phtml

...
<?php echo $this->getChildHtml('abc') // doesn't work ?>
<?php echo $this->getChildHtml('qwer') // works ?>
...

Best Answer

If its a module loading issue, I think you should add a tag in your module declaration file. like below

<depends> <companyname_modulename/> </depends>

This will insure that your module will be loaded after companyname_modulename