mage-enhanced-admin-grids icon indicating copy to clipboard operation
mage-enhanced-admin-grids copied to clipboard

added column min_qty to products grid, now how do we make it editable

Open seansan opened this issue 8 years ago • 0 comments
trafficstars

added column min_qty to products grid, now how do we make it editable

Hi we joined the min_qty and added to collection

Only problem is that the tick mark for "Editable' is not there. Any hint on how we can make this column save on change too?

Help appreciated

    public function addColumnsToGrid($observer)
    {
        $block = $observer->getBlock();

        if ($block instanceof Mage_Adminhtml_Block_Catalog_Product_Grid
            || $block instanceof Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Super_Config_Grid
            || ($block instanceof Mage_Adminhtml_Block_Widget_Grid && $block->getNameInLayout() === 'category.product.grid')
        ) {
            $block->addColumnAfter('min_qty',
                array(
                    'header'=> Mage::helper('catalog')->__('Min_Qty'),
                    'type'  => 'number',
                    'index' => 'min_qty',
                    'width' => '50px'
            ), 'qty');
        }
    }

    public function joinFieldsToCollection($observer)
    {
        $collection = $observer->getCollection();
        $collection->joinField('min_qty',
                'cataloginventory/stock_item',
                'min_qty',
                'product_id=entity_id',
                '{{table}}.stock_id=1',
                'left');
    }

seansan avatar Jan 17 '17 16:01 seansan