Creating new attribute using addAttribute() in installation scripts
You are using the incorrect setup class. Mage_Eav_Model_Entity_Setup
has never had access to catalog-specific properties, which reside in the additional table (catalog_eav_attribute
).
You either need to register catalog/setup
as your module's setup resource or (more likely) instantiate it directly in your setup script:
$installer = Mage::getResourceModel('catalog/setup', 'catalog_setup');
In order to understand the mapping, refer to Mage_Catalog_Model_Resource_Setup::_prepareValues()
. I (warning: self-promotion) recently posted a detailed dive of EAV attribute configuration at http://www.webguys.de/magento/eav-attribute-setup/.
you can try below one it will work for your requirement. This is the syntax of create the attribute via installer script.
$installer = $this;
$installer->startSetup();
$installer->addAttribute('catalog_product', 'page_layout', array(
'type' => 'varchar',
'backend' => '',
'frontend' => '',
'label' => 'Page Layout',
'input' => 'select',
'class' => '',
'source' => 'catalog/product_attribute_source_layout',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
'visible' => true,
'required' => false,
'user_defined' => false,
'default' => '',
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => false,
'unique' => false,
'group' => 'Design'
));
$installer->endSetup();