Magento add a column to backend newsletter gridview

In the magento system, I added the columns subscriber_firstname and subscriber_lastname to the newsletter_subscriber db table.

In the admin area of magento, I want the Newsletter>Newsletter Subscribers grid table to show:

  • customer first name if it exists, otherwise show newsletter_subscriber.subscriber_firstname if it exists, otherwise show nothing
  • customer last name if it exists, otherwise show newsletter_subscriber.subscriber_lastname if it exists, otherwise show nothing

Which magento files do I need to edit to make this work? How do I go about editing the files to make this work?

2 thoughts on “Magento add a column to backend newsletter gridview”

  1. app/code/core/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid.php

    You’ll want to condition this based off if subscriber_firstname or subscriber_lastname have values or not:

        $this->addColumn('subscribername', array(
            'header'    => Mage::helper('newsletter')->__('Subscriber First Name'),
            'index'     => 'subscriber_firstname',
            'default'   =>    '----'

    Also, make sure to make a copy of the core files and NOT edit them directly!

  2. the quick and easy solution is to create a column render and select the correct field based on the subscriber type e.g.


    class Mage_Adminhtml_Block_Newsletter_Subscriber_Renderer_FirstName extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
        public function render(Varien_Object $row) {
            $value = '';
            if ($row->getData('type') == 2) {
                $value = $row->getData('customer_firstname');
            else {
                $value = $row->getData('subscriber_firstname');
            return $value;

    then add your render to a local copy of the subscriber grid class

        $this->addColumn('firstname', array(
            'header'    => Mage::helper('newsletter')->__('First Name'),
            'index'     => 'customer_firstname',
            'default'   => '----',
            'renderer'  => 'Mage_Adminhtml_Block_Newsletter_Subscriber_Renderer_FirstName'

    Note. the search and sort will not work on the subscriber name fields, to get this working you will need to extend app/code/core/Mage/Newsletter/Model/Mysql4/Subscriber/Collection.php

Leave a Reply

Your email address will not be published. Required fields are marked *