I have created a custom attribute for the categories using installer script.

But I want to show that attribute only on level two categories.For all other levels it should not be visible.( This attribute is not mandatory field )

$installer->addAttribute('catalog_category', 'short_name', array(
    'group'                    => 'General Information',
    'input'                    => 'text',
    'type'                     => 'varchar',
    'label'                    => 'Short Category Name',
    'visible'                  => true,
    'required'                 => false,
    'visible_on_front'         => true,
    'is_html_allowed_on_front' => true,
    'global'                   => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,

Screenshot of requirement

Is it possible to hide it from specific levels ? I mean by hide that it should not be visible.

1 Answer 1


I would use a custom renderer. In the install script, add something like:

'input_renderer' => 'stack_category/custom_renderer'

And create a block class like:

class Stack_Category_Block_Custom_Renderer extends Varien_Data_Form_Element_Text
    public function getHtml()
        if (Mage::registry('current_category')->getLevel() == 2) {
            return parent::getHtml();
        return '';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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