2

I added attributes in this way without problems:

$this->startSetup();
$installer = new Mage_Sales_Model_Resource_Setup('core_setup');
$entities = array(
    'quote_item',
);
$options = array(
    'type'     => Varien_Db_Ddl_Table::TYPE_DECIMAL,
    'visible'  => true,
    'required' => false
);
foreach ($entities as $entity) {
    $installer->addAttribute($entity, 'packing', $options);
}
$installer->endSetup();
$this->endSetup();

But when I try to remove the attributes it gives me error: WRONG Entity ID:

$this->startSetup();
$installer = new Mage_Sales_Model_Resource_Setup('core_setup');
$entities = array(
    'quote_item',
);
foreach ($entities as $entity) {
    $installer->removeAttribute($entity, 'packing');
}
$installer->endSetup();
$this->endSetup();

1 Answer 1

1
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$attribute = 'packing'; 
$setup->removeAttribute('quote_item', $attribute);
$setup->endSetup();
1
  • This example is the same as mine, only that I do a cycle. Does not work. M1.9.3.3 #0 /var/www/html/app/code/core/Mage/Eav/Model/Entity/Setup.php(194): Mage::exception('Mage_Eav', 'Wrong entity ID') #1 /var/www/html/app/code/core/Mage/Eav/Model/Entity/Setup.php(881): Mage_Eav_Model_Entity_Setup->getEntityTypeId('quote_item') #2 /var/www/html/app/code/core/Mage/Eav/Model/Entity/Setup.php(987): Mage_Eav_Model_Entity_Setup->getAttribute('quote_item', 'packing') #3 /var/www/html/test.php(8): Mage_Eav_Model_Entity_Setup->removeAttribute('quote_item', 'packing')
    – BOES
    Sep 16, 2018 at 12:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.