I'm new to magento and trying to add quantity column to the grid in related products tab (edit product -> related products). this is what I did:
- overwrite related.php file:
Mage\Adminhtml\Block\Catalog\Product\Edit\Tab\Related.php
- added to
_prepareCollection()
method this code:
$collection->joinField( 'qty', 'cataloginventory_stock_item', 'qty', 'product_id = entity_id', '{{table}}.stock_id = 1', 'left' );
- and added
to _prepareColumns()
methods this code:
$this->addColumn('qty', array( 'header' => Mage::helper('catalog')->__('QTY'), 'width' => 80, 'index' => 'qty'
Now I can see the new column but the quantity is float number (for example 100.00) and I can't filter results based on my new QTY
column.
My questions:
- is that all I need to add column or I have to do some thing else??
- how to display QTY in integer format (for example 100 not 100.00)??
- why I can't filter results based on the QTY??
any idea will be appreciated, Thanks in advance..