Skip to main content
1 of 2
Piyush
  • 5.9k
  • 9
  • 34
  • 66

Replace your code in grid.php with this

$this->addColumn('color', array( 'header' =>Mage::helper('reports')->__('Product Color'), 'sortable' =>false, 'index' =>'color', 'type' => 'options', 'renderer' => 'module_name/adminhtml_module_name_renderer_color',));

Now create a file in directory: Company/Modulename/Block/Adminhtml/Modulename/Renderer/Color.php

class Company_Modulename_Block_Adminhtml_Modulename_Renderer_Color extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
{
   public function render(Varien_Object $row)   
   {
        $value = $row->getData($this->getColumn()->getIndex());
        $attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'color');
        $options = array();
        foreach( $attribute->getSource()->getAllOptions(true, true) as $option ) {
          $id = $option['value'];
           if ($id==$value) 
           {
            echo $option['label'];
           }
       
        }

        
   }
}
Piyush
  • 5.9k
  • 9
  • 34
  • 66