11
。 我沒有找到相關的解決方案/問題。我只是想知道如何通過API將新屬性分配給某個特定屬性集的產品。如何通過Magento API以編程方式將屬性分配給特定屬性集?標題爲
。 我沒有找到相關的解決方案/問題。我只是想知道如何通過API將新屬性分配給某個特定屬性集的產品。如何通過Magento API以編程方式將屬性分配給特定屬性集?標題爲
事情是這樣的:
$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);
我不能肯定究竟上,你會怎麼做,但我想,使用Mage_Eav_Model_Mysql4_Entity_Attribute_Collection
和Mage_Eav_Model_Entity_Attribute_Group
將讓你在正確的方向...
上帝保佑你,我工作了8個小時來解決這個問題:D – zuzuleinen 2012-08-13 13:11:45