To render the text-values of an multiselect in a BE-grid:
<?php
/**
*
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* It is available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
*
*
* @category AskSheldon
* @package AskSheldon_Adminhtml
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @author Marcel Lange <info@ask-sheldon.com>
*
* Renders the multiselect value texts in product grid in BE
*
* AskSheldon_Adminhtml_Block_Catalog_Widget_Grid_Column_Renderer_Image
*
*/
class AskSheldon_Adminhtml_Block_Catalog_Widget_Grid_Column_Renderer_Multiselecttext
extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
{
const VALUE_DEFAULT_GLUE = "< br />";
/**
* Renders grid column
*
* @param Varien_Object $row
* @return string
*/
public function render(Varien_Object $row)
{
if($this->_getValue($row)){
$values = $row->getAttributeText($this->getColumn()->getIndex());
$glue = $this->getData('glue');
if(!$glue){
$glue = self::VALUE_DEFAULT_GLUE;
}
return implode($glue, $values);
}
return '-';
}
}
