Skip to content

Instantly share code, notes, and snippets.

@RabeaWahab
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RabeaWahab/aa5eabc6c64342e2969b to your computer and use it in GitHub Desktop.
Save RabeaWahab/aa5eabc6c64342e2969b to your computer and use it in GitHub Desktop.
$this->startSetup();
/**
* Use those two commands to delete the attribute for testing
*/
//$this->removeAttribute('catalog_category', 'custom_attribute_1');
//$this->removeAttribute('catalog_category', 'custom_attribute_2');
// creating the attributes
$this->addAttribute('catalog_category', 'custom_attribute_1', array(
'input' => 'multiselect',
'type' => 'text',
'label' => 'Category Filters',
'backend' => 'eav/entity_attribute_backend_array', // this is important so the system can undertsand to convert the options to a string to be saved
'visible' => true,
'required' => false,
'visible_on_front' => true,
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
'source' => 'Custom_Module_Model_Options', // you use this for custom option in your own class
'position' => 100,
'group' => 'Custom Attribute 1',
'user_defined' => true,
));
$this->addAttribute('catalog_category', 'custom_attribute_2', array(
'input' => 'select',
'type' => 'int',
'label' => 'Category Filters Enabled',
'backend' => '',
'visible' => true,
'required' => false,
'visible_on_front' => true,
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
'source' => 'eav/entity_attribute_source_boolean',
'position' => 99,
'group' => 'Custom Attribute 2',
'user_defined' => true,
));
$this->endSetup();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment