When creating an attribute inside an upgrade script (using class Mage_Catalog_Model_Resource_Setup)
Is it possible to also assign the attribute to a specific attribute set only?
My code is:
$installer->addAttribute('catalog_product', 'my_attribute', array(
'type' => 'varchar',
'input' => 'text',
'label' => 'My Attribute',
'visible' => true,
'required' => false,
'attribute_set' => 'My Attribute Set'
));
But the attribute only goes in default set
asked May 27, 2014 at 15:56
Marty Wallace
5,64113 gold badges68 silver badges91 bronze badges
1 Answer 1
You need to set the attribute group:
$installer->addAttribute('catalog_product', 'my_attribute', array(
'type' => 'varchar',
'input' => 'text',
'label' => 'My Attribute',
'visible' => true,
'required' => false,
'attribute_set' => 'My Attribute Set',
'group' => 'Default' // <-- Change group if not default.
));
answered Jun 17, 2014 at 0:36
B00MER
8,3072 gold badges22 silver badges49 bronze badges
default