protected function _prepareCollection() { $helper = Mage::helper('mandrill'); $mail = $helper->api()->setApiKey($helper->getApiKey()); $emails = $mail->usersSenders(); if ($emails !== FALSE) { $_emails = array(); foreach ($emails as $email) { $email = new Varien_Object((array) $email); $_emails[] = array('email' => $email->getAddress(), 'sent' => $email->getSent(), 'rejects' => $email->getRejects(), 'complaints' => $email->getComplaints(), 'unsubs' => $email->getUnsubs(), 'opens' => $email->getUniqueOpens(), 'clicks' => $email->getUniqueClicks(), 'hard_bounces' => $email->getHardBounces(), 'soft_bounces' => $email->getSoftBounces(), 'created_at' => $email->getCreatedAt()); } $collection = Mage::getModel('mandrill/customcollection', array($_emails)); } else { $collection = Mage::getModel('mandrill/customcollection', array(array())); } $this->setCollection($collection); return parent::_prepareCollection(); }