Latheesan
Latheesan

Reputation: 24116

Magento new custom order line "qty" field

Magento currently has the following standard "qty" fields; for each order lines (for example):

[qty_canceled] => 0.0000
[qty_invoiced] => 1.0000
[qty_ordered] => 1.0000
[qty_refunded] => 0.0000
[qty_shipped] => 1.0000

On the order view, you can see it like this:

enter image description here What I'd like to do is add a new custom field called qty_allocated

This new field is going to be used with a 3rd party integration for automated order processing and I don't want to use the official qty fields.

Does anyone know if this is possible? If so, how can I go about achieving this? I need to be able to display/update this field also on Magento.

Thanks in advance for any tips/guides.

Upvotes: 0

Views: 320

Answers (1)

Andrew
Andrew

Reputation: 12809

An Example creating an attrtibute for an order item:

$installer = new Mage_Sales_Model_Resource_Setup('core_setup');

$installer ->addAttribute('order_item', 'qty_allocated', array(
    'label'     => 'QTY Allocated',
    'type'      => 'varchar',
    'input'     => 'text',
    'visible'   => true,
    'required'  => false,
    'position'  => 10,
));
//$installer->endSetup();

Upvotes: 0

Related Questions