如您所知,在数据库中,newsletter_subscriber表具有customer_id列
在管理简报订阅者网格中,我添加了像这样的列客户组
$this->addColumn('customer_group', array(
'header' => Mage::helper('newsletter')->__('Customer Group'),
'index' => 'customer_group'
));
那么如何从customer_id中获取客户群?
THKS
答案 0 :(得分:1)
修改protected function _prepareCollection()
方法
$collection->getSelect()->join(array('ce'=>'customer_entity'),'ce.entity_id=main_table.customer_id',array('ce.group_id'));
$collection->getSelect()->join(array('cg'=>'customer_group'),'cg.customer_group_id=ce.group_id',array('cg.customer_group_code'));
$this->setCollection($collection);
然后像这样添加字段
$this->addColumn('customer_group_code', array(
'header' => Mage::helper('newsletter')->__('Customer Group'),
'index' => 'customer_group_code'
));