2010-09-16 31 views

Trả lời

29

Something như thế này:

$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); 
+0

Chúa ban phước cho bạn, tôi đã làm việc 8 giờ để giải quyết vấn đề này: D – zuzuleinen

0

Tôi không chắc chắn vào chính xác làm thế nào bạn sẽ làm điều đó, nhưng tôi sẽ tưởng tượng rằng việc sử dụng Mage_Eav_Model_Mysql4_Entity_Attribute_CollectionMage_Eav_Model_Entity_Attribute_Group sẽ giúp bạn đi đúng hướng ...

Các vấn đề liên quan