What I want to achive is, to show one column in the catalog grid, which contains the stock status.
Here is my code for adding it to the collection that:
$collection->joinTable( 'cataloginventory/stock_status','product_id=entity_id', array("stock_status" => "stock_status") )
->addAttributeToSelect('stock_status');
I also add a new column:
$this->addColumn('stock_status',
array(
'header'=> 'Stock Status',
'width' => '60px',
'index' => 'stock_status',
'type' => 'options',
'options' => array('1'=>'In Stock','0'=>'Out Of Stock'),
));
The Problem now is that if no stock status is set, there is no entry in the db-table cataloginventory_stock_status. This also means, that products which have no stock status set will not even be displayed in this new catalog grid.
Is there a way to display them anyway?
catalog_inventory_stock_item
and testis_in_stock