Magneto add Manufacture in grid Column for Admin

Add the brand/manufacture in grid for admin

Just open the file app/code/core/Mage/Adminhtml/Block/Catalog/Product/grid.php and
Paste in local folder app/code/local/Mage/Adminhtml/Block/Catalog/Product/grid.php
and add the below code in  _prepareColumns( ) function


$manufacturer_items = Mage::getModel('eav/entity_attribute_option')->getCollection()->setStoreFilter()->join('attribute','attribute.attribute_id=main_table.attribute_id', 'attribute_code');

        foreach ($manufacturer_items as $manufacturer_item) :
            if ($manufacturer_item->getAttributeCode() == 'manufacturer')
                $manufacturer_options[$manufacturer_item->getOptionId()] = $manufacturer_item->getValue();
        endforeach;

        $this->addColumn('manufacturer',
            array(
                'header'=> Mage::helper('catalog')->__('Manufacturer'),
                'width' => '100px',
                'type'  => 'options',
                'index' => 'manufacturer',
                'options' => $manufacturer_options
        ));

Note: Just replace the manufacture by your attribute ID 

0 comments: