Exemplo n.º 1
1
 public function sendConfirmationSuccessEmail()
 {
     if (Mage::getStoreConfig('monkey/general/active', Mage::helper('monkey')->getThisStore()) == 1) {
         return $this;
     } else {
         return parent::sendConfirmationSuccessEmail();
     }
 }
Exemplo n.º 2
0
 /**
  * Get Customer Subscription Object Information
  *
  * @return Mage_Newsletter_Model_Subscriber
  */
 public function getSubscriptionObject()
 {
     if (!$this->_subscription) {
         $this->_subscription = Mage::getModel('Mage_Newsletter_Model_Subscriber');
         $this->_subscription->loadByCustomer(Mage::getSingleton('Mage_Customer_Model_Session')->getCustomer());
     }
     return $this->_subscription;
 }
Exemplo n.º 3
0
 /**
  * Preapares data for saving of subscriber
  * Add the line for rapidmail status
  *
  * @param  Mage_Newsletter_Model_Subscriber $subscriber
  * @return array
  */
 protected function _prepareSave(Mage_Newsletter_Model_Subscriber $subscriber)
 {
     $data = array();
     $data['customer_id'] = $subscriber->getCustomerId();
     $data['store_id'] = $subscriber->getStoreId() ? $subscriber->getStoreId() : 0;
     $data['subscriber_status'] = $subscriber->getStatus();
     $data['subscriber_email'] = $subscriber->getEmail();
     $data['subscriber_confirm_code'] = $subscriber->getCode();
     $data['rapidmail_status'] = $subscriber->getRapidmailStatus();
     if ($subscriber->getIsStatusChanged()) {
         $data['change_status_at'] = Mage::getSingleton('core/date')->gmtDate();
     }
     $validators = array('subscriber_email' => 'EmailAddress');
     $filters = array();
     $input = new Zend_Filter_Input($filters, $validators, $data);
     $session = Mage::getSingleton($this->_messagesScope);
     if ($input->hasInvalid() || $input->hasMissing()) {
         foreach ($input->getMessages() as $message) {
             if (is_array($message)) {
                 foreach ($message as $error) {
                     $session->addError($error);
                 }
             } else {
                 $session->addError($message);
             }
         }
         Mage::throwException(Mage::helper('newsletter')->__('Form was filled incorrectly'));
     }
     return $data;
 }
Exemplo n.º 4
0
 public function sendUnsubscriptionEmail()
 {
     if (!Mage::getStoreConfig('remarketing/subscription/unsubscribe_email')) {
         return $this;
     }
     return parent::sendUnsubscriptionEmail();
 }
Exemplo n.º 5
0
 /**
  * Send confirmation success email if "is_send_success_email" value equals true
  *
  * @return Sitemaster_Checkout_Model_Subscriber
  */
 public function sendConfirmationSuccessEmail()
 {
     if ($this->getIsSendSuccessEmail()) {
         return parent::sendConfirmationRequestEmail();
     }
     return $this;
 }
Exemplo n.º 6
0
 /**
  * Send mail to subscriber
  *
  * @param   Mage_Newsletter_Model_Subscriber|string   $subscriber   subscriber Model or E-mail
  * @param   array                                     $variables    template variables
  * @param   string|null                               $name         receiver name (if subscriber model not specified)
  * @param   Mage_Newsletter_Model_Queue|null          $queue        queue model, used for problems reporting.
  * @return boolean
  * @deprecated since 1.4.0.1
  **/
 public function send($subscriber, array $variables = array(), $name = null, Mage_Newsletter_Model_Queue $queue = null)
 {
     if (!$this->isValidForSend()) {
         return false;
     }
     $email = '';
     if ($subscriber instanceof Mage_Newsletter_Model_Subscriber) {
         $email = $subscriber->getSubscriberEmail();
         if (is_null($name) && ($subscriber->hasCustomerFirstname() || $subscriber->hasCustomerLastname())) {
             $name = $subscriber->getCustomerFirstname() . ' ' . $subscriber->getCustomerLastname();
         }
     } else {
         $email = (string) $subscriber;
     }
     if (Mage::getStoreConfigFlag(Mage_Core_Model_Email_Template::XML_PATH_SENDING_SET_RETURN_PATH)) {
         $this->getMail()->setReturnPath($this->getTemplateSenderEmail());
     }
     ini_set('SMTP', Mage::getStoreConfig('system/smtp/host'));
     ini_set('smtp_port', Mage::getStoreConfig('system/smtp/port'));
     $mail = $this->getMail();
     $mail->addTo($email, $name);
     $text = $this->getProcessedTemplate($variables, true);
     if ($this->isPlain()) {
         $mail->setBodyText($text);
     } else {
         $mail->setBodyHTML($text);
     }
     $mail->setSubject($this->getProcessedTemplateSubject($variables));
     $mail->setFrom($this->getTemplateSenderEmail(), $this->getTemplateSenderName());
     try {
         //$mail->send();
         $mail->send(Mage::helper('smtp')->getTransport());
         $this->_mail = null;
         if (!is_null($queue)) {
             $subscriber->received($queue);
         }
     } catch (Exception $e) {
         if ($subscriber instanceof Mage_Newsletter_Model_Subscriber) {
             // If letter sent for subscriber, we create a problem report entry
             $problem = Mage::getModel('newsletter/problem');
             $problem->addSubscriberData($subscriber);
             if (!is_null($queue)) {
                 $problem->addQueueData($queue);
             }
             $problem->addErrorData($e);
             $problem->save();
             if (!is_null($queue)) {
                 $subscriber->received($queue);
             }
         } else {
             // Otherwise throw error to upper level
             throw $e;
         }
         return false;
     }
     return true;
 }
Exemplo n.º 7
0
 /**
  * Fetches the rewards customer trying to subscribe
  *
  * @return TBT_Rewards_Model_Customer
  */
 public function getCustomer()
 {
     if ($this->_subscribedCustomer == null) {
         $customer_id = $this->_subscriber->getCustomerId();
         $this->_subscribedCustomer = Mage::getModel('rewards/customer')->load($customer_id);
     }
     return $this->_subscribedCustomer;
 }
 public function sendConfirmationSuccessEmail()
 {
     if (Mage::helper('ddg')->isNewsletterSuccessDisabled($this->getStoreId())) {
         return $this;
     } else {
         parent::sendConfirmationSuccessEmail();
     }
 }
Exemplo n.º 9
0
 /**
  * Send the Emails
  * 
  * @override
  * @todo    make this per store scope!
  * @return  MailUp_MailUpSync_Model_Subscriber
  */
 public function sendUnsubscriptionEmail()
 {
     if ($this->_getConfig()->isNewsletterNotificationDisabled()) {
         Mage::log("Newsletter Notification DISABLED: sendUnsubscriptionEmail");
         return $this;
     } else {
         return parent::sendUnsubscriptionEmail();
     }
 }
Exemplo n.º 10
0
 public function sendConfirmationSuccessEmail()
 {
     $store = Mage::helper('monkey')->getThisStore();
     if (Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::GENERAL_ACTIVE, $store) == 1 && !Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::GENERAL_CONFIRMATION_EMAIL, $store)) {
         return $this;
     } else {
         return parent::sendConfirmationSuccessEmail();
     }
 }
Exemplo n.º 11
0
 public function sendConfirmationSuccessEmail()
 {
     $store = Mage::helper('monkey')->getThisStore();
     Mage::log('store ' . $store->getId(), null, 'santiago.log', true);
     Mage::log(Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::GENERAL_CONFIRMATION_EMAIL, $store), null, 'santiago.log', true);
     if (Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::GENERAL_ACTIVE, $store) == 1 && !Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::GENERAL_CONFIRMATION_EMAIL, $store)) {
         return $this;
     } else {
         Mage::log('parent', null, 'santiago.log', true);
         return parent::sendConfirmationSuccessEmail();
     }
 }
 /**
  * Send subscriber data through API
  *
  * @param Mage_Newsletter_Model_Subscriber $subscriber
  * @return array
  *
  * @todo add unsubscribe functionality
  */
 public function sendSubscriberData(Mage_Newsletter_Model_Subscriber $subscriber)
 {
     $this->_eventType = 'subscriber';
     try {
         $data = array('id' => $subscriber->getSubscriberEmail(), 'key' => 'email', 'keys' => array('email' => $subscriber->getSubscriberEmail()), 'keysconflict' => 'merge', 'lists' => array(Mage::helper('sailthruemail')->getNewsletterList() => 1), 'vars' => array('subscriberId' => $subscriber->getSubscriberId(), 'status' => $subscriber->getSubscriberStatus(), 'Website' => Mage::app()->getStore()->getWebsiteId(), 'Store' => Mage::app()->getStore()->getName(), 'Store Code' => Mage::app()->getStore()->getCode(), 'Store Id' => Mage::app()->getStore()->getId(), 'fullName' => $subscriber->getSubscriberFullName()), 'fields' => array('keys' => 1), 'optout_email' => $subscriber->getSubscriberStatus() != 1 ? 'blast' : 'none');
         $response = $this->apiPost('user', $data);
         $this->setCookie($response);
     } catch (Sailthru_Email_Model_Client_Exception $e) {
         Mage::logException($e);
     } catch (Exception $e) {
         Mage::logException($e);
     }
     return $this;
 }
Exemplo n.º 13
0
 public function initSubscribe(Mage_Newsletter_Model_Subscriber $subscriber, $options = null, $props = null)
 {
     $result = '';
     try {
         $email = $subscriber->getSubscriberEmail();
         $firstname = null;
         if ($subscriber->hasCustomerFirstname()) {
             $firstname = $subscriber->getCustomerFirstname();
         }
         $lastname = null;
         if ($subscriber->hasCustomerLastname()) {
             $lastname = $subscriber->getCustomerLastname();
         }
         $listId = Mage::helper('newsman_newsletter')->getListId();
         $ip = Mage::helper('core/http')->getRemoteAddr();
         $result = $this->getClient()->subscriber->initSubscribe($listId, $email, $firstname, $lastname, $ip, $props, $options);
         if ($result == '') {
             Mage::throwException(Mage::helper('newsman_newsletter')->__('Error on method subscriber.initSubscribe'));
         }
     } catch (Exception $e) {
         Mage::logException($e);
     }
     return $result;
 }
Exemplo n.º 14
0
 /**
  * Add Subscriber Data
  *
  * @param Mage_Newsletter_Model_Subscriber $subscriber
  * @return Mage_Newsletter_Model_Problem
  */
 public function addSubscriberData(Mage_Newsletter_Model_Subscriber $subscriber)
 {
     $this->setSubscriberId($subscriber->getId());
     return $this;
 }
Exemplo n.º 15
0
 public function received(Mage_Newsletter_Model_Subscriber $subscriber, Mage_Newsletter_Model_Queue $queue)
 {
     $this->_write->beginTransaction();
     try {
         $data['letter_sent_at'] = now();
         $this->_write->update($this->_subscriberLinkTable, $data, array($this->_write->quoteInto('subscriber_id=?', $subscriber->getId()), $this->_write->quoteInto('queue_id=?', $queue->getId())));
         $this->_write->commit();
     } catch (Exception $e) {
         $this->_write->rollBack();
         Mage::throwException(Mage::helper('newsletter')->__('Cannot mark as received subscriber'));
     }
     return $this;
 }
Exemplo n.º 16
0
 /**
  * @param Mage_Newsletter_Model_Subscriber $subscriber
  * @param array $randomData
  */
 protected function _anonymizeNewsletterSubscriber($subscriber, $randomData)
 {
     $subscriber->setData('subscriber_email', $randomData['email']);
     $subscriber->getResource()->save($subscriber);
     $this->_anonymizedNewsletterSubscriberIds[] = $subscriber->getId();
 }
Exemplo n.º 17
0
 /**
  * @param Mage_Newsletter_Model_Subscriber $subscriber
  *
  * @return Bronto_Common_Model_Email_Template_Filter
  */
 protected function _filterSubscriber(Mage_Newsletter_Model_Subscriber $subscriber)
 {
     if (!in_array('subscriber', $this->_filteredObjects)) {
         $customer = Mage::getModel('customer/customer')->load($subscriber->getCustomerId());
         $this->_filterCustomer($customer);
         $this->_filteredObjects[] = 'subscriber';
     }
     return $this;
 }
Exemplo n.º 18
0
 public function _construct()
 {
     parent::_construct();
     $this->_init('shopbybrand/subscriber');
 }
Exemplo n.º 19
0
 public function _construct()
 {
     parent::_construct();
 }
Exemplo n.º 20
0
 /**
  * Get the subscribers dob (date of birth) with fallback to customer data
  *
  * @return string
  */
 public function getSubscriberDob()
 {
     $dob = parent::getSubscriberDob();
     if (!$dob && Mage::getStoreConfig('newsletterextended/fields/customer_fallback') && $this->getCustomer()) {
         $dob = $this->getCustomer()->getDob();
     }
     return $dob;
 }
Exemplo n.º 21
0
 /**
  * If subscriber gets deleted we have to unregister the email account in Rapidmail
  */
 public function delete()
 {
     if (Mage::helper('rapidmail')->checkRecipientExists($this->getEmail())) {
         Mage::getSingleton('adminhtml/session')->setDeleteSubscriber(true);
         Mage::helper('rapidmail')->unregisterMail($this->getEmail());
     }
     parent::delete();
 }
Exemplo n.º 22
0
 /**
  * Updates data when subscriber received
  *
  * @param Mage_Newsletter_Model_Subscriber $subscriber
  * @param Mage_Newsletter_Model_Queue $queue
  * @return Mage_Newsletter_Model_Resource_Subscriber
  */
 public function received(Mage_Newsletter_Model_Subscriber $subscriber, Mage_Newsletter_Model_Queue $queue)
 {
     $this->_write->beginTransaction();
     try {
         $data['letter_sent_at'] = Mage::getSingleton('Mage_Core_Model_Date')->gmtDate();
         $this->_write->update($this->_subscriberLinkTable, $data, array('subscriber_id = ?' => $subscriber->getId(), 'queue_id = ?' => $queue->getId()));
         $this->_write->commit();
     } catch (Exception $e) {
         $this->_write->rollBack();
         Mage::throwException(Mage::helper('Mage_Newsletter_Helper_Data')->__('Cannot mark as received subscriber.'));
     }
     return $this;
 }
Exemplo n.º 23
0
 /**
  * Retrieve unsubsription url
  *
  * @param   Mage_Newsletter_Model_Subscriber $subscriber
  * @return  string
  */
 public function getUnsubscribeUrl($subscriber)
 {
     $params = array('id' => $subscriber->getId(), 'code' => $subscriber->getCode());
     return $this->_getUrl('newsletter/subscriber/unsubscribe', $params);
 }
Exemplo n.º 24
0
 protected function _prepareSave(Mage_Newsletter_Model_Subscriber $subscriber)
 {
     $data = array();
     $data['customer_id'] = $subscriber->getCustomerId();
     $data['store_id'] = $subscriber->getStoreId() ? $subscriber->getStoreId() : 0;
     $data['subscriber_status'] = $subscriber->getStatus();
     $data['subscriber_email'] = $subscriber->getEmail();
     $data['subscriber_confirm_code'] = $subscriber->getCode();
     $data['salutation'] = $subscriber->getSalutation();
     $data['firstname'] = $subscriber->getFirstname();
     $data['lastname'] = $subscriber->getLastname();
     $data['company'] = $subscriber->getCompany();
     $data['address'] = $subscriber->getAddress();
     $data['country_id'] = $subscriber->getCountryId();
     $data['city'] = $subscriber->getCity();
     $data['state'] = $subscriber->getState();
     $data['phoneno'] = $subscriber->getPhoneno();
     $data['fax'] = $subscriber->getFax();
     $data['zipcode'] = $subscriber->getZipcode();
     //ADD A NEW FIELD END
 }
Exemplo n.º 25
0
 public function sendUnsubscriptionEmail()
 {
     if (Mage::helper('mailchimp')->checkSendUnsubscribe()) {
         return parent::sendUnsubscriptionEmail();
     } else {
         return $this;
     }
 }
Exemplo n.º 26
0
 /**
  * Convert Magento Newsletter Subscriber Status to Bronto API Contact Status
  *
  * @param Mage_Newsletter_Model_Subscriber $subscriber
  *
  * @return boolean
  */
 public function getQueueStatus(Mage_Newsletter_Model_Subscriber $subscriber)
 {
     // Set correct status based on subscriber status
     switch ($subscriber->getStatus()) {
         case Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED:
             $status = Bronto_Api_Contact::STATUS_ACTIVE;
             break;
         case Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED:
             $status = Bronto_Api_Contact::STATUS_UNSUBSCRIBED;
             break;
         case Mage_Newsletter_Model_Subscriber::STATUS_UNCONFIRMED:
             $status = Bronto_Api_Contact::STATUS_UNCONFIRMED;
             break;
         case Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE:
         default:
             $status = Bronto_Api_Contact::STATUS_TRANSACTIONAL;
             break;
     }
     return $status;
 }
Exemplo n.º 27
0
 public function save()
 {
     parent::save();
     Mage::dispatchEvent($this->_eventPrefix . '_save_after', array('subscriber' => $this));
 }
Exemplo n.º 28
0
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    Magento
 * @package     Mage_Newsletter
 * @subpackage  integration_tests
 * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
require __DIR__ . '/../../../Mage/Core/_files/store.php';
$currentStore = Mage::app()->getStore()->getId();
$otherStore = Mage::app()->getStore('fixturestore')->getId();
$subscriber = new Mage_Newsletter_Model_Subscriber();
$subscriber->setStoreId($currentStore)->setSubscriberEmail('*****@*****.**')->setSubscriberStatus(Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED)->save();
$subscriber = new Mage_Newsletter_Model_Subscriber();
$subscriber->setStoreId($otherStore)->setSubscriberEmail('*****@*****.**')->setSubscriberStatus(Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED)->save();
Exemplo n.º 29
0
 /**
  * Retrieve unsubsription url
  *
  * @param Mage_Newsletter_Model_Subscriber $subscriber
  * @return string
  */
 public function getUnsubscribeUrl($subscriber)
 {
     return Mage::getModel('Mage_Core_Model_Url')->setStore($subscriber->getStoreId())->getUrl('newsletter/subscriber/unsubscribe', array('id' => $subscriber->getId(), 'code' => $subscriber->getCode(), '_nosid' => true));
 }
Exemplo n.º 30
0
 /**
  * Add Subscriber to Bronto Newsletter Opt-in queue
  *
  * @param Mage_Newsletter_Model_Subscriber $subscriber
  * @param int                              $storeId
  *
  * @return $this|bool
  */
 private function _saveToQueue(Mage_Newsletter_Model_Subscriber $subscriber, $storeId)
 {
     // Get e-mail address we are working with
     $email = $subscriber->getEmail();
     if (empty($email)) {
         $this->_helper->writeError('Subscriber does not have an email address.');
         return false;
     }
     // Get Calculated Status
     $status = Mage::helper('bronto_newsletter/contact')->getQueueStatus($subscriber);
     /* @var $contactQueue Bronto_Newsletter_Model_Queue */
     $contactQueue = Mage::getModel('bronto_newsletter/queue')->getContactRow($subscriber->getId(), $storeId);
     // If ContactQueue status doesn't match subscriber status, replace it
     if ($status != $contactQueue->getStatus()) {
         if ($subscriber->getSubscribeSource() == 'popup') {
             $contactQueue->setImported(2);
         } else {
             $contactQueue->setImported(0);
         }
         $contactQueue->setSubscriberEmail($subscriber->getEmail())->setStatus($status)->setMessagePreference('html')->setSource('api')->setUpdatedAt(Mage::getSingleton('core/date')->gmtDate())->save();
     }
     return $this;
 }