1

I use this code to add attribute group 'test1' into attribute set 'test'. But it always add to all attribute sets.

$attributeSetId = $model->getAttributeSetId('catalog_product','test');

$installer->addAttributeGroup('catalog_product',$attributeSetId,'test1');
0

Try below code:

    $attribute_set_name = 'your attribute set name here';
$group_name = 'your attribute group here';
$attribute_code = 'your attribute code here';

$setup = new Mage_Eav_Model_Entity_Setup('core_setup');

//-------------- add attribute to set and group
$attribute_set_id=$setup->getAttributeSetId('catalog_product', $attribute_set_name);
$attribute_group_id=$setup->getAttributeGroupId('catalog_product', $attribute_set_id, $group_name);
$attribute_id=$setup->getAttributeId('catalog_product', $attribute_code);

$setup->addAttributeToSet($entityTypeId='catalog_product',$attribute_set_id, $attribute_group_id, $attribute_id);

Reference: https://stackoverflow.com/questions/3730103/how-can-a-attribute-be-assigned-to-specific-attribute-set-programmatically-via-m

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.