*/ class Mage_Newsletter_Model_Observer { public function subscribeCustomer($observer) { $customer = $observer->getEvent()->getCustomer(); if (($customer instanceof Mage_Customer_Model_Customer)) { Mage::getModel('newsletter/subscriber')->subscribeCustomer($customer); } return $this; } /** * Customer delete handler * * @param Varien_Object $observer * @return Mage_Newsletter_Model_Observer */ public function customerDeleted($observer) { $subscriber = Mage::getModel('newsletter/subscriber') ->loadByEmail($observer->getEvent()->getCustomer()->getEmail()); if($subscriber->getId()) { $subscriber->delete(); } return $this; } public function scheduledSend($schedule) { $countOfQueue = 3; $countOfSubscritions = 20; /** @var Mage_Newsletter_Model_Resource_Queue_Collection $collection */ $collection = Mage::getModel('newsletter/queue')->getCollection() ->setPageSize($countOfQueue) ->setCurPage(1) ->addOnlyForSendingFilter() ->load(); $collection->walk('sendPerSubscriber', array($countOfSubscritions)); } }