I've got a Module that allows someone to add products to a warehouse. In the products listing under the warehouse, I've got the product_id, stock etc.
What I would like is for the product_id to be represented by the SKU and the name instead as the product_id doesn't give anyone much.
/**
* Override of the Prepare Collection method on the Mage_Adminhtml_Block_Widget_Grid
* Defines the collection for the data within the grid
*
* @return Mage_Adminhtml_Block_Widget_Grid
* @author Dan Hanly
**/
public function _prepareCollection()
{
if (!$this->_model) {
$this->setModel(Mage::getModel('inventorymanagement/warehouse_product'));
}
// Override the Collection for the Class
$collection = $this->_model->getCollection();
$this->setCollection($collection);
// Return the Completed Grid
return parent::_prepareCollection();
}
/**
* Override of the Prepare Columns method on the Mage_Adminhtml_Block_Widget_Grid
* Defines the columns for the grid
*
* @return Mage_Adminhtml_Block_Widget_Grid
* @author Dan Hanly
**/
public function _prepareColumns()
{
$this->addColumn('product_id', array(
'header' => $this->__('Product'),
'index' => 'product_id'
));
$this->addColumn('stock', array(
'header' => $this->__('Current Stock'),
'index' => 'stock'
));
$this->addColumn('low_level', array(
'header' => $this->__('Low Level Notification'),
'index' => 'low_level'
));
$this->addColumn('critical_level', array(
'header' => $this->__('Critical Level Notification'),
'index' => 'critical_level'
));
return parent::_prepareColumns();
}
Above is what I have so far, and I have a feeling that it's either going to be done in the prepareCollection method or the prepareColumns one.
Can anybody help?