I have added a custom attribute to the table sales_order_flat, and I'm trying to display this attribute in a grid in sales_order/index.
I did this with client attributes successfully, but I get errors when trying to do the same with order data.
<global>
<blocks>
<adminhtml>
<rewrite>
<sales_order_grid>WACI_AdminHtmlExt_Block_Sales_Order_Grid</sales_order_grid>
</rewrite>
</adminhtml>
</blocks>
Application / code / local / namespace / module / Block / Sales / Order / Grid.php
class WACI_AdminHtmlExt_Block_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid
{
protected function _prepareColumns()
{
$this->addColumn('dynamics_ord', array(
'header' => $this->__('Dynamics ID'),
'width' => '75px',
'index' => 'dynamics_ord',
));
$this->addColumnsOrder('dynamics_ord','entity_id');
return parent::_prepareColumns();
}
}
I see it is _prepareCollection sometimes used , but I'm trying to just change the collection in time setCollectionfor, if nothing more, simplicity.
In any case, the column is displayed, but no data is created. (And page errors when I try to sort).
Any ideas on this?
Update
SO. , . sales_flat_order, sales_flat_order_grid.
, , ( ).
- updateGridRecords() ?
= > updateGridRecords $order- > save() (- ).
, - , _prepareColumns - , .
= > yep. attr. Win!