1

I'm just a beginner in magento and I was trying to figure it out that how magento handles the product display for different product types. Then I come to know about the layout system used by magento where all blocks/view are handled by xml (correct me if I'm wrong). So, for product view I'd found catalog.xml in which four blocks are there for product types

PRODUCT_TYPE_simple
PRODUCT_TYPE_configurable
PRODUCT_TYPE_grouped
PRODUCT_TYPE_virtual

My question is how these tags are selected/loaded for generating view and what happens to product type bundle and downloadable?

5

Mage_Catalog : this is responsible for Simple / Configurable / Virtual / Grouped product types. So those types are defined in Mage/Catalog/etc/config.xml

Mage_Bundle : this is responsible for Bundle product type. The type has defined in Mage/Bundle/etc/config.xml

Mage_Downloadable: this is reponsible for Downloadable products. This type is defined in Mage/Downloadable/etc/config.xml

How magento renders this product handlers are as below.

Bundle product type : app/design/frontend/base/default/layout/bundle.xml

Downloadable product type : app/design/frontend/base/default/layout/downloadable.xml

<PRODUCT_TYPE_bundle translate="label" module="bundle">
    <label>Catalog Product View (Bundle)</label>
    <reference name="head">
        <action method="addItem"><type>skin_js</type><name>js/bundle.js</name></action>
    </reference>
    <reference name="product.info">
        <block type="bundle/catalog_product_view_type_bundle" name="product.info.bundle" as="product_type_data" template="bundle/catalog/product/view/type/bundle.phtml">
            <action method="addPriceBlockType"><type>bundle</type><block>bundle/catalog_product_price</block><template>bundle/catalog/product/price.phtml</template></action>
            <block type="bundle/catalog_product_price" name="bundle.prices" as="bundle_prices" template="bundle/catalog/product/view/price.phtml">
                <action method="setMAPTemplate"><tmpl>catalog/product/price_msrp_item.phtml</tmpl></action>
            </block>
        </block>
    </reference>
    <reference name="product.info.options.wrapper">
        <block type="bundle/catalog_product_view_type_bundle" name="product.info.bundle.options" as="type_bundle_options" template="bundle/catalog/product/view/type/bundle/options.phtml">
            <action method="addRenderer"><type>select</type><block>bundle/catalog_product_view_type_bundle_option_select</block></action>
            <action method="addRenderer"><type>multi</type><block>bundle/catalog_product_view_type_bundle_option_multi</block></action>
            <action method="addRenderer"><type>radio</type><block>bundle/catalog_product_view_type_bundle_option_radio</block></action>
            <action method="addRenderer"><type>checkbox</type><block>bundle/catalog_product_view_type_bundle_option_checkbox</block></action>
        </block>
        <action method="insert"><block>product.info.bundle.options</block></action>
    </reference>
    <reference name="product.info.options.wrapper.bottom">
        <remove name="product.tierprices" />
        <block type="bundle/catalog_product_view" name="bundle.tierprices" as="tierprices" before="-" template="bundle/catalog/product/view/tierprices.phtml"/>
        <block type="cataloginventory/qtyincrements" name="product.info.qtyincrements" before="-" template="cataloginventory/qtyincrements.phtml"/>
    </reference>
    <reference name="product.clone_prices">
        <action method="addPriceBlockType"><type>bundle</type><block>bundle/catalog_product_price</block><template>bundle/catalog/product/view/price.phtml</template></action>
    </reference>
</PRODUCT_TYPE_bundle>

For example I'll put several block names which renders when bundle product is showing.

  • The block bundle/catalog_product_price is responsible for outputting the bundle price
  • Outputs option selection forms using the bundle/catalog_product_view_type_bundle block
  • References product.clone_prices to set a block outputting the final configured price that uses a bundle-specific template.

For more info refer http://www.solvingmagento.com/magento-bundle-product-type-part-1/

3

For Downloadable product Magento use downloadable.xml For Bundle Product Magento use bundle.xml

If you want to locate this files then go to your root directory

\app\design\frontend\base\default\layout then find two files which I mention.

Magento Manage using this two xml file for downloadable and bundle product.

11
  • why do these xml are seperated and how do <PRODUCT_TYPE_type> rendered? Dec 26 '13 at 9:28
  • Magento provide you five type of products creation so they create the different files for handling different type of stuff.
    – Keyul Shah
    Dec 26 '13 at 9:34
  • this is okay but your answer is not completely satisfying me. can you give me more details about how these xml files are rendered? Dec 26 '13 at 9:39
  • for that you have to read magento Book so you can got proper idea how magento call the xml and phtml files.
    – Keyul Shah
    Dec 26 '13 at 9:45
  • 1
    Downloadable and bundled were introduced later in Magento and belong to separate modules, hence the separate layout XML files.
    – benmarks
    Dec 26 '13 at 13:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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