0

I am calling a block left.phtml from my main store file like this:

<?php echo $this->getChildHtml('left') ?>

In the layout file this is described as:

<reference name="left">
        <block type="marketplace/storeleft" name="store_left" template="marketplace/storesearch/left.phtml" />
</reference>

Till now everything is working fine. Now I want to call another block from within this block:

    <div class="parlor-detail-top">
        <div class="shop_bakery">
            <a href="#" class="shop_now">SHOP NOW</a>
        </div>
        <?php echo $this->getChildHtml('rate_bakery'); ?>
    </div>

I have changed the layout file for this

<reference name="left">
    <block type="marketplace/storeleft" name="store_left" template="marketplace/storesearch/left.phtml" />
    <block type="marketplace/storeleft" name="rate_bakery" template="marketplace/storesearch/ratebakery.phtml"/>
</reference>

But this new block is getting included after the "left" block. How do I include this new block within the "left" block and not after?

1 Answer 1

1

Use Parent Child Tree Structure

<reference name="left">
    <block type="marketplace/storeleft" name="store_left" template="marketplace/storesearch/left.phtml">
        <block type="marketplace/storeleft" name="rate_bakery" template="marketplace/storesearch/ratebakery.phtml"/>
    </block>
</reference>
6
  • It does not load the child block (rate_bakery) when I use this parent child tree structure. I checked the source also ... it just ignores this child block using this method. Jan 30, 2016 at 8:00
  • Paste Your Layout XML here Jan 30, 2016 at 8:12
  • You are calling in getChildHtml('rate_bakery') in phtml of store_left block right ? Jan 30, 2016 at 8:15
  • Yes. I am calling it from within store_left block. Jan 30, 2016 at 8:22
  • Okay just verify xml again and make sure you have added rate_bakery block as child of store_left block Jan 30, 2016 at 8:37

Your Answer

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

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