Adding existing attribute to all attribute sets

前端 未结 6 1897
孤街浪徒
孤街浪徒 2021-02-06 05:53

I have an existing attribute for an embed code. I need to associate this attribute with 120+ existing attribute sets.

If I know the attribute set id, ho

6条回答
  •  Happy的楠姐
    2021-02-06 06:55

    $attributeSets = Mage::getResourceModel('eav/entity_attribute_set_collection')
        ->setEntityTypeFilter('4'); // Catalog Product Entity Type ID
    foreach ($attributeSets as $attributeSet) {
        $installer->addAttributeToSet(
            Mage_Catalog_Model_Product::ENTITY,   // Entity type
            $attributeSet->getAttributeSetName(), // Attribute set name
            'General',                            // Attribute set group name
            $yourAttributeCode,
            100                                   // Position on the attribute set group
        );
    }
    

提交回复
热议问题