// get all available options for custom attribute
$options = array();
$attribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'attribute_name');
if(!empty($attribute)){
$opts = $attribute->getFrontend()->getSelectOptions();
foreach($opts as $opt){
if(empty($opt['value'])) // skip empty option
continue;
$options[$opt['value']] = $opt['label'];
}
}
// now add column in grid
$this->addColumn('attribute_name', array(
'header' => Mage::helper('customer')->__('Some Attribute Name'),
'index' => 'attribute_name',
'type' => 'options',
'options' => $options // gere is array with all available options
));
P.S. to select attribute value from database, need to open collection.php model for your report and use
->addAttributeToSelect('attribute_name');
I can't provide excat example, because each report may use other classes and method. this was just an example of what function exists, you can find examples in magento to see how it works and where you can use it
No comments:
Post a Comment