Question

I have a module which adds some catalog attributes and some sales attributes.

Usually i would extend the correct setup type for which i want to add attributes for but obviously cannot do this here since they are both different.

My setup type is defined as Mage_Eav_Model_Entity_Setup

This works fine for catalog attributes.

But i need to add to the sales table also. How can this be achieved in the same module?

Specifically i am using addAttribute to ad product attribute and i also want to add a field to order_item

Was it helpful?

Solution

The sales setup uses Mage_Sales_Model_Resource_Setup. Could you not just create an object of this type and then proceed as normal.

$installer = Mage::getModel('sales/resource_setup', 'sales_setup');
$installer->startSetup();
$installer->addAttribute(
    'order_item',
    'attribute_code',
    array(
            'label' => 'Attribute label',
            'type'  => 'type'
            )
    );
$installer->endSetup();
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top