Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Why are blocks defined within blocks? 
 
JazzcatCB
Jr. Member
 
Total Posts:  24
Joined:  2008-02-06
 

In the layout below, <block name="product_list"> is defined within <block name="category.products"> Why? What does this do? Thanks.

<!--
Category default layout
-->

    <
catalog_category_default>
        <
reference name="left">
            <
block type="catalog/navigation" name="catalog.leftnav" after="currency" template="catalog/navigation/left.phtml"/>
        </
reference>
        <
reference name="content">
            <
block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">
                <
block type="catalog/product_list" name="product_list"></block>
            </
block>
        </
reference>
    </
catalog_category_default>
 
Magento Community Magento Community
Magento Community
Magento Community
 
iblastoff
Sr. Member
 
Total Posts:  252
Joined:  2007-08-31
 

doesn’t it contain your product list within the the category view?

 
Magento Community Magento Community
Magento Community
Magento Community
 
JazzcatCB
Jr. Member
 
Total Posts:  24
Joined:  2008-02-06
 

Ok. That makes sense. Do you think there is a relationship between <block name="product_list"> and the getProductListHtml() method in the category/view template?

 
Magento Community Magento Community
Magento Community
Magento Community
 
iblastoff
Sr. Member
 
Total Posts:  252
Joined:  2007-08-31
 

getProductListHtml() just returns $this->getChildHtml(’product_list’)

although i have no idea why its just in its own function…

 
Magento Community Magento Community
Magento Community
Magento Community
 
JazzcatCB
Jr. Member
 
Total Posts:  24
Joined:  2008-02-06
 

Ah. Good to know. Thank you!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top