Some time you need to add many select option in magento attribute and this will take time to add options one by one in magento admin panel.
So here is the code to add select,checkbox and other type of magento attributes programmatically.
Just run this code in your any .phtml file or you can create file on root of magento and run this file manually.
Code : Add select type attribute in magento
$setup = Mage::getModel(‘eav/entity_setup’, ‘core_setup’);
//$installer = new Mage_Eav_Model_Entity_Setup(‘core_setup’);
$setup->startSetup();
$attr = array (
‘attribute_model’ => NULL,
‘backend’ => ”,
‘type’ => ‘int’,
‘table’ => ”,
‘frontend’ => ”,
‘input’ => ‘select’,
‘label’ => ‘Manufacturer’,
‘frontend_class’ => ”,
‘source’ => ”,
‘required’ => ‘0’,
‘user_defined’ => ‘1’,
‘default’ => ”,
‘unique’ => ‘0’,
‘note’ => ”,
‘input_renderer’ => NULL,
‘global’ => ‘1’,
‘visible’ => ‘1’,
‘searchable’ => ‘1’,
‘filterable’ => ‘1’,
‘comparable’ => ‘1’,
‘visible_on_front’ => ‘0’,
‘is_html_allowed_on_front’ => ‘0’,
‘is_used_for_price_rules’ => ‘1’,
‘filterable_in_search’ => ‘1’,
‘used_in_product_listing’ => ‘0’,
‘used_for_sort_by’ => ‘0’,
‘is_configurable’ => ‘1’,
‘apply_to’ => ‘simple’,
‘visible_in_advanced_search’ => ‘1’,
‘position’ => ‘1’,
‘wysiwyg_enabled’ => ‘0’,
‘used_for_promo_rules’ => ‘1’,
‘option’ =>
array (
‘values’ =>
array (
‘Toyota’,’Volkswagen Group’,’Samsung Electronics’, ‘Daimler’,’Ford’,’Nissan’),
),
);
$setup->addAttribute(Mage_Catalog_Model_Product::ENTITY, ‘manufacturer’, $attr);
$setup->endSetup();
You can change label and code and also pass array in the values to add options.abobe code is used for add select type attribute in magento programmatically.