0

i am extend the newsletter module in mangento(1.9), in the newsletter queue grid having column name recipients, but in table don't have a column name like that.

May i know from where that field value is coming.

For your further reference i have attached some screen and code in grid file.

in queue grid class
-------------------
  $this->addColumn('subscribers_total', array(
            'header'    =>  Mage::helper('newsletter')->__('Recipients'),
            'type'      => 'number',
            'index'     => 'subscribers_total'
        ));

newsletter_queue table

enter image description here

News letter grid

enter image description here

1 Answer 1

0

In Newsletter Queue Grid magento get the collection as below

$collection = Mage::getResourceModel('newsletter/queue_collection')
            ->addSubscribersInfo();

Mage_Adminhtml_Block_Newsletter_Queue_Grid. In the newsletter/queue_collection magento join the newsletter_queue_link table.

You can see the code in Mage_Newsletter_Model_Resource_Queue_Collection

$select = $this->getConnection()->select()
            ->from(array('qlt' => $this->getTable('newsletter/queue_link')), 'COUNT(qlt.queue_link_id)')
            ->where('qlt.queue_id = main_table.queue_id');
        $totalExpr = new Zend_Db_Expr(sprintf('(%s)', $select->assemble()));
        $select = $this->getConnection()->select()
            ->from(array('qls' => $this->getTable('newsletter/queue_link')), 'COUNT(qls.queue_link_id)')
            ->where('qls.queue_id = main_table.queue_id')
            ->where('qls.letter_sent_at IS NOT NULL');
        $sentExpr  = new Zend_Db_Expr(sprintf('(%s)', $select->assemble()));

        $this->getSelect()->columns(array(
            'subscribers_sent'  => $sentExpr,
            'subscribers_total' => $totalExpr
        ));
        return $this; 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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