Add “in stock/Out Of Stock” column in Products Grid in Backend Magento
1) Copy over app/code/core/Mage/Adminhtml/Block/Catalog/Product/Grid.php
to app/code/local/Mage/Adminhtml/Block/Catalog/Product/Grid.php
2) add the code below in app/code/local/Mage/Adminhtml/Block/Catalog/Product/Grid.php inside/under
_prepareCollection()
AFTER
->addAttributeToSelect('type_id');
and before
if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory'))
CODE:
$collection->joinTable( 'cataloginventory/stock_item', 'product_id=entity_id',
array("stock_status" => "is_in_stock") )->addAttributeToSelect('stock_status');
3) add the below in in same file _prepareColumns()
$this->addColumn('stock_status',
array(
'header'=> 'Stock Status', //this is the title of the column
'width' => '60px', // this is the width of the column
'index' => 'stock_status',
'type' => 'options',
'options' => array('1'=>'In Stock','0'=>'Out Of Stock'),
));
Hit like or leave comment if post help!
Please support us, Like us on Facebook.
Subscribe to:
Post Comments (Atom)
not working in magento 1.7
ReplyDeleteThis is working in magento 1.7 as well.
DeleteWorks in 1.8.1 too. :-) Thanks
ReplyDelete