I'm trying to update an EAV attribute's default value, but the new default is not pulling through.

The attribute is

                'include_in_menu'    => array(
                    'type'                       => 'int',
                    'label'                      => 'Include in Navigation Menu',
                    'input'                      => 'select',
                    'source'                     => 'eav/entity_attribute_source_boolean',
                    'default'                    => '1',
                    'sort_order'                 => 10,
                    'global'                     => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
                    'group'                      => 'General Information',

Mage_Catalog_Model_Resource_Setup::getDefaultEntities() ln 325

It was added in app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-, with the default value being '1'.

I need to set the default value to '0', and have created an update script:

/* @var $this Mage_Core_Model_Resource_Setup */
$installer = $this;


// set Include in Navigation Menu under Display Settings to default NO for new categories
$installer->updateAttribute('catalog_category', 'include_in_menu', 'default_value', '0');


This affects the new category form, when adding a new root or sub category, but the field still defaults to 'Yes'.

There has not been any other code added to affect that field, but when I debug, when the block gets created in Mage_Core_Model_Layout::createBlock it's returned the field is set to '1' and not '0' as expected.

Could anyone help me analyze this problem? I have checked the DB and the default value was updated by the update script, and when the attributes are loaded the default value of include_in_menu is '0'.

1 Answer 1


include_in_menu is hardcoded to 1 for new categories in app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Attributes.php _prepareForm around line 154:

    if (!$this->getCategory()->getId()){                                                                                                                                      

see https://github.com/OpenMage/magento-mirror/blob/magento-1.8/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Attributes.php#L154

if you want include_in_menu to respect attribute's default_value just rewrite app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Attributes.php _prepareForm and comment those lines.

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.