0

in vendor.xml file Difference between

<catalog_category_default >       
        <reference name="content">
            <block type="vendor/vendor" name="vendor" template="vendor/vendor.phtml" />
        </reference>
    </catalog_category_default>

and

<catalog_category_view>       
        <reference name="content">
            <block type="vendor/vendor" name="vendor" template="vendor/vendor.phtml" />
        </reference>
    </catalog_category_view>

both are showing my vendor form on all category page but what they have diff..

  1. I want to show a vendor block on particular category. how i show.....
5

catalog_category_view is loaded for all the category pages.
It's the default layout handler for the category page. The category page maps to the catalog module, category controller, view action.

catalog_category_default is loaded only for categories that are not marked as anchors.
There is also a layout handle called catalog_category_layered that is loaded for categories marked as anchor.

If you want to show a particular block for one single category, you can either make it as a static block and use the category display settings. Set the display mode as Static block and products and select the appropriate static block.
Or you can use the layout handle <CATEGORY_{ID_HERE}>. replace {ID_HERE} with the category id.
Also you can try to use the custom xml layout field in the category display settings in the backend.

[EDIT]
To use the category handle do this:
Let's say that you want to add a block for category with id 10.
Add this in the layout

<CATEGORY_10>
    <reference name="content"> 
        <block type="vendor/vendor" name="vendor" template="vendor/vendor.phtml" />     
    </reference>
</CATEGORY_10>
  • Again I failed to answer first. Kudos to @Marius. I learned this point from you of course. You are a great teacher :) – Rajeev K Tomy Aug 4 '14 at 12:10
  • How i add <CATEGORY_{ID_HERE}> in my xml file my code is :<catalog_category_view> <reference name="content"> <block type="vendor/vendor" name="vendor" template="vendor/vendor.phtml" /> </reference> </catalog_category_view> – PankajR Aug 4 '14 at 13:14
  • @PankajR. See my update – Marius Aug 4 '14 at 13:20
1

catalog_category_view page handler contains layout that will render when a category page view is requested. However layout placed in catalog_category_default handler will not be rendered for every category page. It render only if that category is not a layered category. For layered category, instead of catalog_category_default,catalog_category_layered will be used.

A category become default or layered depend upon the setting that we made through admin. If we need layered navigation in a category, we need to set isAnchor option to yes for that category through admin. For that case the layout handler used will be catalog_category_layered. If the option set to No, then the handler used by Magento will be catalog_category_default.

But for both cases, catalog_category_view will use. For every category view request, this handler will process

0

In a simple word, Magento is calling catalog_category_view as default category layout handler.

But this layout handler is updated by function getLayoutUpdateHandle() (Mage_Catalog_Model_Category).But function changing layout according to condition

we can say that when a category Anchor is yes (is_anchor value yes) then magento used layout for that category page:catalog_category_layered

also when a category Anchor(is_anchor value yes) then when a category Anchor is no(is_anchor value no) then you catalog_category_default

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.