Magento – How to find name of block

blockslayoutmagento-1magento-1.9template

I have created my package based on rwd magento 1.9. When I click on a category, say, Women I go to page

frontend/my_package/default/template/page/1column.phtml (template hints)

In the middle of this page there is a block with template hint:

frontend/base/default/template/catalog/category/view.phtml

and Mage_Catalog_Block_Category_View. I want to place my module which has subcategories with images into this block. I just can't find the name of the block to insert into. In my layout file I want something like:

  <catalog_category_view>
    <reference name="????????">
       <block type="women/subcategories"  name="subcategoriesblock" as="subcategoriesblock"      template="subcats/subcats.phtml"/>
    </reference>
  </catalog_category_view>

I have used

$blocks = Mage::app()->getLayout()->getAllBlocks();

to get block names in current page and have tried and tested the various block names but nothing seems to work. Could somebody help and give some suggestion as to how I might get the name of the relevant block. All help will be greatly appreciated.

Best Answer

On top of what everyone else said, you can use the following code in the template file to find out the block name:

$this->getNameInLayout();
Related Topic