Magento:以编程方式从属性集中删除属性

Mar*_*rco 7 installation attributes magento

我需要一个函数或一些代码来从分配给它的集合中删除一个属性.我知道这个函数,分配一个属性:

$setup->addAttributeToSet($entityTypeId, $setId, $groupId, $attributeId, $sortOrder=null)
Run Code Online (Sandbox Code Playgroud)

或删除属性:

$setup->removeAttribute($entityTypeId, $code)
Run Code Online (Sandbox Code Playgroud)

但不应删除该属性.必须再也无法在AttributeSet中找到属性'Default'(组'General').

我没有找到任何功能:

removeAttributeFromAttributeSet()
Run Code Online (Sandbox Code Playgroud)

或某事 像那样

Lee*_*ite 9

您可以在安装脚本中尝试此代码

<?php
/** @var $this Mage_Eav_Model_Entity_Setup */
$this->startSetup();

$this->deleteTableRow(
    'eav/entity_attribute', 
    'attribute_id', 
    $this->getAttributeId('catalog_product', 'attribute_code_here'), 
    'attribute_set_id', 
    $this->getAttributeSetId('catalog_product', 'Default')
);

$this->endSetup();
Run Code Online (Sandbox Code Playgroud)