6

How to add newsletter subscription in customer grid in admin?

If customer is subscribed newsletter then it should show subscribed/unsubscribed status in column.

I rewrite the module in my local folder

0

here i guess if you successful add grid in customer grid you can try to use renderer

like below

class Namespace_Yourmodule_Block_Customerrenderer extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
{   
    public function render(Varien_Object $row)
    {
        $customerId =  $row->getId(); // get customer id here

        $subscriber = Mage::getModel('newsletter/subscriber')->load($customerId);
        if ($subscriber->getId()) {
            return "subscribed";
        }
        return "unsubscribe";
    }
}

call rendere in your attach column grid like below

$this->addColumn('newsletter_subscribe', array(
'header' => $this->__('newsletter subscribe'),
    'align'  => 'center',
    'renderer'  => 'Namespace_Yourmodule_Block_Customerrenderer'
));

i am sure it will worth for you. its just idea not whole code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.