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: 1- is that all I need to add column or I have to do some thing else?? 2- how to display QTY in integer format (for example 100 not 100.00)?? 3- why I can't filter results based on the QTY?? any idea will be appreciated, thanx in advance..
No comments:
Post a Comment