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; $installer->startSetup(); $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' => '' )); $installer->addAttributeToGroup( $entityTypeId, $attributeSetId, $attributeGroupId, 'textfield_name', '30' ); $installer->endSetup();
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_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!