首页 文章

如何从订户magento获得客户群

提问于
浏览
0

如您所知,在数据库中,newsletter_subscriber表具有customer_id列

在admin newsletter订阅者网格中,我添加了这样的列Customer Group

$this->addColumn('customer_group', array(
        'header'    => Mage::helper('newsletter')->__('Customer Group'),
        'index'     => 'customer_group'

    ));

那么如何从customer_id中获取客户群?

THKS

1 回答

  • 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'
        ));
    

相关问题