Adding a new attribute

Last modified by vinai-kung on Fri, June 25, 2010 09:15
Source|Old Revisions  

This is an old revision of the document!

In order to add a new attribute to your magento installation, you can use following method:

Create an instance of Mage_Eav_Model_Entity_Setup class and use its method addAttribute() to add one.

$setup = new Mage_Eav_Model_Entity_Setup(’core_setup’); $setup->addAttribute($entityTypeId, $code, $attr);

$attr is an array containing Attribute elements (like frontend and backend model, default value, etc.)

For details look at the sourcecode: