好的,可以使用以下内容添加magento中的新属性集:
$entitySetup = new Mage_Eav_Model_Entity_Setup;
$entitySetup->addAttributeSet('catalog_product', $setName);
Run Code Online (Sandbox Code Playgroud)
但是我如何将该集合基于默认的现有集合.此选项在管理部分中可用,因此可以使用.
我 6 个月前这样做了,我不再有代码了,但我知道你必须在你的属性集上使用 initFromSkeleton ()方法。您可以在 Magento 的代码中搜索对此函数的调用,调用很少(也许只有一个)。它会告诉你它的用法。
编辑:我记得我遇到了你所说的同样的问题,并且我邮寄了它。这是我被建议的用法:
$attrSet = Mage::getModel('eav/entity_attribute_set');
$attrSet->setAttributeSetName('MyAttributeSet');
$attrSet->setEntityTypeId(4);//You can look into the db what '4' corresponds to, I think it is for products.
$attrSet->initFromSkeleton($attrSetId);
$attrSet->save();
Run Code Online (Sandbox Code Playgroud)
初始化是在保存之前完成的。
| 归档时间: |
|
| 查看次数: |
3441 次 |
| 最近记录: |