-
- rosew

-
Total Posts: 43
Joined: 2009-03-07
Leatherhead UK
|
You can try this:
Add this function to your collection class:
public function addExpressionToSelect($alias, $expression)
{
// validate alias
if (isset($this->_joinFields[$alias])) {
throw Mage::exception(’Mage_Eav’, Mage::helper(’eav’)->__(’Joined field or attribute expression with this alias is already declared’));
}
$this->getSelect()->from(null, array($alias=>$expression));
$this->_joinFields[$alias] = array(
‘table’ => false,
‘field’ => $expression
);
return $this;
}
Then in your grid class:
$collection->addExpressionToSelect(’customer’, ‘CONCAT(table1.value,” “,table2.value)’);
$this->addColumn(’customer’, array(
‘header’=> Mage::helper(’sales’)->__(’Customer’),
‘width’ => ‘80px’,
‘type’ => ‘text’,
‘index’ => ‘customer’,
));
Hope that helps.
Rose
|