0

I re-developed the whole category page in a layout.xml file included in my custom module, trying to reuse the block names. I needed to change many block (type) classes.

I had read that by redefining the block it overwrote but it is not so. Now the category page works correctly but the block category.products" is printed 2 times.

<catalog_category_default>
    <reference name="content">
        <block type="ristothemefrontend_handler/catalog_category_view" name="category.categories" template="catalog/category/category-categories.phtml" />
        <block type="ristothemefrontend_handler/catalog_category_view" name="category.products" template="catalog/category/view.phtml">
            <block type="ristothemefrontend_handler/catalog_product_list" name="product_list" template="catalog/product/list.phtml">
                <action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
                <block type="ristothemefrontend_handler/catalog_product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
                    <block type="page/html_pager" name="product_list_toolbar_pager" />
                    <block type="ristothemefrontend_handler/catalog_product_list_toolbar" name="catalog.left" template="catalog/category/left.phtml">
                        <block type="ristothemefrontend_handler/catalog_category_view" name="catalog.left.categories" as="categories" template="catalog/category/categories.phtml" />
                        <block type="risto_programmablebanners/list" name="catalog.left.banners" as="banners">
                            <action method="setBlockType"><type>category</type></action>
                        </block>
                    </block>
                    <block type="ristothemefrontend_handler/catalog_layer_view" name="catalog.left.layer" template="catalog/layer/view.phtml">
                        <action method="unsetChild"><alias>category_filter</alias></action>
                    </block>
                    <block type="ristothemefrontend_handler/catalog_product_list_toolbar" name="category.toolbar" template="catalog/category/toolbar.phtml" />
                </block>
                <block type="ristothemefrontend_handler/catalog_category_view" name="category.products.long_description" template="catalog/category/long_description.phtml"/>
            </block>
        </block>
    </reference>
</catalog_category_default>

The blocks in the previous layouts (base / default etc.) are not overwritten, but loaded.

I have to use:

<action method="unsetChild"><name>category.products</name></action>

Before redefining. Is it correct to use it this way?

Your Answer

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

Browse other questions tagged or ask your own question.