I ended up resolving this by changing the event I was observing to adminhtml_block_html_before
and then adding a little fancy finagling to re-sort the columns and allow for proper filtering. The old event was occuring before the default columns were being set up which is why they couldn't be removed.
Here is the updated method with the new lines added below $block->removeColumn('status');
public function updateColumns($observer)
{
$block = $observer->getBlock();
if (!isset($block)) return $this;
if ($block->getType() == 'adminhtml/catalog_product_grid') {
$boolOptions = array('1' => 'Yes', '0' => 'No');
// Add new columns
$block->addColumnAfter('model_number', array(
'header' => 'Model No.',
'type' => 'text',
'index' => 'model_number',
), 'sku');
$block->addColumnAfter('discontinued', array(
'header' => 'Disc.',
'type' => 'options',
'index' => 'discontinued',
'options' => $boolOptions,
), 'qty');
// Remove columns
$block->removeColumn('status');
$block->sortColumnsByOrder();
// register current block, needed to extend the collection in the observer
Mage::register('jks_grid_current_block', $block);
// call _prepareCollection to reload the collection and apply column filters
$this->_callProtectedMethod($block, '_prepareCollection');
// remove current block to prevent race conditions in later collection loads
Mage::unregister('jks_grid_current_block');
}
}
Thanks goes out to this nifty GridControl extension which helped make the solution more obvious.
Best Answer
You need to extend the order grid (assuming that it is already familiar to you).
in the extended php file app/code/local/Yournamespace/Yourmodule/Block/Adminhtml/.../Grid.php
then inside
protected function _prepareColumns()
method replace the following codewith
You're done!
in your module config.xml
under config tag...
in app/code/local/Yournamespace/Yourmodule/Model/Adminhtml/Observer.php