Question

How would I add a custom field to the order grid?

I have the following code by looking at other questions but after I have ran the code the new field is not showing up.

require_once('app/Mage.php');
Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID));
$installer = new Mage_Sales_Model_Mysql4_Setup;
$attribute  = array(
'type'       => 'int',
'input'      => 'select',
'label'      => 'Exported',
'sort_order' => 1000,
'required'   => false,
'visible_on_front' => '0',
'filterable'    => true,
'global'     => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
'backend'    => 'eav/entity_attribute_backend_array',
'option'     => array (
        'values' => array(
            0 => 'No',
            1 => 'Yes',
        )
    )
);
$installer->addAttribute('order', 'Exported', $attribute);
$installer->addAttribute('quote', 'Exported', $attribute);
$installer->endSetup();
Was it helpful?

Solution

This question is answered in this forum. You can follow instructions in this thread:

Add Column to Admin > Sales > Orders Grid

OTHER TIPS

See Add Column to a grid (observer) - Column ‘store_id’ in where clause is ambiguous issue for details on how to add a column to the sales/order grid thru an observer (so without using rewrites)

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top