Thursday, February 9, 2012

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
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

No comments:

Post a Comment

Thankyou for your Comments

LinkWithin

Blog has moved, searching new blog...