0

I have a CMS Page named Home, with the following code within the Design->Layout Update Xml

<reference name="content">
    <block type="core/template" template="homepage/home.phtml">
        <reference name="featured">
            <block type="catalog/product_list" name="featured" template="catalog/product/list.phtml">
                <action method="setCategoryId"><category_id>2</category_id></action>
                <action method="setColumnCount"><count>5</count></action>
            </block>
        </reference>
    </block>
</reference>

and this within homepage/home.phtml

<div class="container home">
        <div class="promo">
           // Promo Here
        </div>

        <?php echo $this->getChildHtml('featured'); ?>
</div>

My main goal is trying to get the featured block inserted into the homepage/home.phtml template, but with the current layout xml in the CMS Page above it is not showing.

All help is greatly appreciated.

William
  • 1,033
  • 2
  • 13
  • 25

3 Answers3

1

There are issue in xml files, i have modify ... the code

<reference name="content">
    <block type="core/template" template="homepage/home.phtml" >
            <block type="catalog/product_list" name="featured" template="catalog/product/list.phtml">
                <action method="setCategoryId"><category_id>2</category_id></action>
                <action method="setColumnCount"><count>5</count></action>
            </block>
    </block>
</reference>

Rest of all same..

Amit Bera
  • 7,581
  • 7
  • 31
  • 57
  • I just tried this and the product_list still isn't echoing in the homepage/page.phtml using `getChildHtml('featured'); ?>` ... Do I need to make changes somewhere else for this inner echo to work ? – William May 30 '14 at 18:34
0

getChildHtml('featured'); ?> 'featured' is name of block not reference .If you want to call the block within template you will use the following block syntax {{block type="catalog/product_list" name="featured" as="featured" template="catalog/product/list.phtml"}}

Sourav
  • 113
  • 3
0

modify the code like that, I believe the name of the block "home_content" should be there.

<reference name="content">
    <block type="core/template" name="home_content" template="homepage/home.phtml" >
        <block type="catalog/product_list" name="featured" template="catalog/product/list.phtml">
            <action method="setCategoryId"><category_id>2</category_id></action>
            <action method="setColumnCount"><count>5</count></action>
        </block>
    </block>
</reference>

I hope it will help you.

Jai
  • 51
  • 5