3

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

1 Answer 1

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

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.