Magento: Neues Kategorie Attribute hinzufügen / Adding category attributes
Add a mysql setup file inside the directory of your module YourNamespace/YourModule/sql/yourmodule_setup/ and write the following code in your module’s mysql setup file:
$installer = $this; $setup = new Mage_Eav_Model_Entity_Setup('core_setup'); $installer->startSetup(); $setup->addAttribute('catalog_category', 'my_attribute', array( 'group' => 'General', 'input' => 'text', 'type' => 'varchar', 'label' => 'My Attribute', 'backend' => '', 'frontend' => '', 'visible' => 1, 'required' => 0, 'user_defined' => 1, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'visible_on_front' => 1, 'unique' => 0, )); // add attribute to group $installer->addAttributeToGroup('catalog_category', 'Default', 'my_module', 'my_attribute'); $installer->endSetup();
Now you found the code my_attribute and the label My Attribute. You can find it under Admin Panel / Catalog / Manage Categories / General Information .
With the array param ’sort_order‘ you can define the order in the backend-list.