I would like to remove some of the default columns from the product grid in the Magento admin. I have tapped into the core_block_abstract_prepare_layout_before
event an can successfully add new columns using addColumnAfter()
, but when I try a removeColumn() on a default column it doesn't seem to do anything.
Here is my observer method...
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');
}
}