I had a module installed in Magento in my old shop store and now I migrate to the new one. What module did is it basically added some custom text fields to the categories that were then displayed on the category page. The following code in the sql folder of the module made corresponding entries in the database:

$installer = $this;

$entityTypeId = $installer->getEntityTypeId('catalog_category');
$attributeSetId = $installer->getDefaultAttributeSetId($entityTypeId);
$attributeGroupId = 4; // 4 = General Information

$installer->addAttribute('catalog_category', 'textfield_name', array(
    'type' => 'varchar',
    'label' => 'Textfield Title',
    'input' => 'text',
    'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
    'visible' => TRUE,
    'required' => FALSE,
    'user_defined' => FALSE,
    'visible_on_front' => TRUE,
    'is_html_allowed_on_front' => FALSE,
    'default' => ''



After module was installed I got this new field displayed on the category properties page in the new store backend. I stored some text in it and then tried to retrieve it as follows:


but I didn't get anything. Also I made certain that Mage::getSingleton('catalog/layer')->getCurrentCategory() was indeed the right category.

There was though one significant detail that I have changed in the new store. In the layout that defines the block which runs the latter code I had to change the scope from catalog_category_layered to catalog_category_default in order for the block to be displayed. I suppose it is relevant, but I don't know what to do next.

Thank you in advance!

  • 2
    Did you rebuild your indexes?
    – Marius
    Commented Feb 19, 2015 at 9:06
  • @Marius God bless you fellow man.
    – nakajuice
    Commented Feb 19, 2015 at 9:16
  • @Marius, I second that! I was puzzled for about an hour and was about to post a new question. Totally forgot to rebuild indexes...It's always the simple things that escape me :)
    – maGz
    Commented Jun 23, 2016 at 20:33

2 Answers 2


Just so this question has an answer ...based on the comments.
The category flat index needs to be refreshed.

As a general rule, when adding a new attribute to the category entity and if the flat category flag is set to yes the index needs to be rebuilt.
This happens because, the new column corresponding to the new attribute does not exist in the flat tables, and on frontend the categories are retrieved from those tables.

If the flat category flat is off, then rebuilding indexes is not mandatory.


Try the following -:

$catID = Mage::getSingleton('catalog/layer')->getCurrentCategory()->getId();

$category = Mage::getModel('catalog/category')->load($catID);

$textField = $category->getTextfieldName();

Hope it helps

Cheers S

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.