Geetha j
Geetha j

Reputation: 33

What is Block meaning in Magento?

I cant understand the meaning of,

{{block type="catalog/product_list" category_id="2" name="home.catalog.product.list" alias="products_homepage" template="catalog/product/list.phtml"}}

What is meaning of type="catalog/product_list" ? Which file its denote?

Please Explain me?

I am try.

app/code/core/Mage/Catalog/Block ,inside i cant find Product list file. Anything wrong in my search?Sorry for my silly question am new to magento.

Manage Category Image

Home page Cms

Cms page

Upvotes: 2

Views: 113

Answers (1)

Suman KC
Suman KC

Reputation: 3528

Navigate to => app/code/core/Mage/catalog/Block/Product/List.php    

And you will see a class Mage_Catalog_Block_Product_List, so the block type="catalog/product_list" is referencing to this block class and links the tempate.

update It links your template to that particular block. if you go see at template ="catalog/product/list.phtml" (i.e. app/design/frontend/yourpackage/yourtheme/template/catalog/product/list.phtml) you will see the the methods of this block being called.

Also, on list.phtml file echo get_class($this). you will see the same block class being printed.

Would you try this on Layout Update XML of your homepage

<reference name="content">
    <block type="catalog/product_list" name="home.catalog.product.list" as="products_homepage" template="catalog/product/list.phtml">
        <action method="setData"><key>category_id</key><value>2</value></action>
    </block>
</reference>

Upvotes: 2

Related Questions