当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Newsletter_Model_Queue类代码示例

本文整理汇总了PHP中Mage_Newsletter_Model_Queue的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Newsletter_Model_Queue类的具体用法?PHP Mage_Newsletter_Model_Queue怎么用?PHP Mage_Newsletter_Model_Queue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Mage_Newsletter_Model_Queue类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testSendPerSubscriberProblem

 /**
  * @magentoDataFixture Mage/Newsletter/_files/queue.php
  * @magentoAppIsolation enabled
  */
 public function testSendPerSubscriberProblem()
 {
     $mail = $this->getMock('Zend_Mail', array('send'), array('utf-8'));
     $brokenMail = $this->getMock('Zend_Mail', array('send'), array('utf-8'));
     $errorMsg = md5(microtime());
     $brokenMail->expects($this->any())->method('send')->will($this->throwException(new Exception($errorMsg, 99)));
     $template = $this->getMock('Mage_Core_Model_Email_Template', array('_getMail'));
     $template->expects($this->any())->method('_getMail')->will($this->onConsecutiveCalls($mail, $brokenMail));
     $queue = new Mage_Newsletter_Model_Queue(array('email_template' => $template));
     $queue->load('Subject', 'newsletter_subject');
     // fixture
     $problem = new Mage_Newsletter_Model_Problem();
     $problem->load($queue->getId(), 'queue_id');
     $this->assertEmpty($problem->getId());
     $queue->sendPerSubscriber();
     $problem->load($queue->getId(), 'queue_id');
     $this->assertNotEmpty($problem->getId());
     $this->assertEquals(99, $problem->getProblemErrorCode());
     $this->assertEquals($errorMsg, $problem->getProblemErrorText());
 }
开发者ID:nemphys,项目名称:magento2,代码行数:24,代码来源:QueueTest.php

示例2: setStores

 public function setStores(Mage_Newsletter_Model_Queue $queue)
 {
     $this->_getWriteAdapter()->delete($this->getTable('queue_store_link'), $this->_getWriteAdapter()->quoteInto('queue_id = ?', $queue->getId()));
     if (!is_array($queue->getStores())) {
         $stores = array();
     } else {
         $stores = $queue->getStores();
     }
     foreach ($stores as $storeId) {
         $data = array();
         $data['store_id'] = $storeId;
         $data['queue_id'] = $queue->getId();
         $this->_getWriteAdapter()->insert($this->getTable('queue_store_link'), $data);
     }
     $this->removeSubscribersFromQueue($queue);
     if (count($stores) == 0) {
         return $this;
     }
     $subscribers = Mage::getResourceSingleton('advancednewsletter/subscriber_collection')->addFieldToFilter('store_id', array('in' => $stores))->addFilterSubscribed()->addFilterSegments($queue->getTemplate()->getSegmentsCodes())->load();
     $subscriberIds = array();
     foreach ($subscribers as $subscriber) {
         $subscriberIds[] = $subscriber->getId();
     }
     if (count($subscriberIds) > 0) {
         $this->addSubscribersToQueue($queue, $subscriberIds);
     }
     return $this;
 }
开发者ID:xiaoguizhidao,项目名称:magento,代码行数:28,代码来源:Queue.php

示例3: addQueueData

 /**
  * Add Queue Data
  *
  * @param Mage_Newsletter_Model_Queue $queue
  * @return Mage_Newsletter_Model_Problem
  */
 public function addQueueData(Mage_Newsletter_Model_Queue $queue)
 {
     $this->setQueueId($queue->getId());
     return $this;
 }
开发者ID:hyhoocchan,项目名称:mage-local,代码行数:11,代码来源:Problem.php

示例4: useQueue

 /**
  * Set loading mode subscribers by queue
  *
  * @param Mage_Newsletter_Model_Queue $queue
  * @return Mage_Newsletter_Model_Resource_Subscriber_Collection
  */
 public function useQueue(Mage_Newsletter_Model_Queue $queue)
 {
     $this->getSelect()->join(array('link' => $this->_queueLinkTable), "link.subscriber_id = main_table.subscriber_id", array())->where("link.queue_id = ? ", $queue->getId());
     $this->_queueJoinedFlag = true;
     return $this;
 }
开发者ID:quyip8818,项目名称:Mag,代码行数:12,代码来源:Collection.php

示例5: getStores

 /**
  * Returns queue linked stores
  *
  * @param Mage_Newsletter_Model_Queue $queue
  * @return array
  */
 public function getStores(Mage_Newsletter_Model_Queue $queue)
 {
     $adapter = $this->_getReadAdapter();
     $select = $adapter->select()->from($this->getTable('newsletter/queue_store_link'), 'store_id')->where('queue_id = :queue_id');
     if (!($result = $adapter->fetchCol($select, array('queue_id' => $queue->getId())))) {
         $result = array();
     }
     return $result;
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:15,代码来源:Queue.php

示例6: received

 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;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:13,代码来源:Subscriber.php

示例7: useQueue

 /**
  * Set loading mode subscribers by queue
  *
  * @param Mage_Newsletter_Model_Queue $queue
  */
 public function useQueue(Mage_Newsletter_Model_Queue $queue)
 {
     $queueLinkTable = Mage::getSingleton('core/resource')->getTableName('advancednewsletter/queue_link');
     $this->getSelect()->join(array('link' => $queueLinkTable), "link.subscriber_id = main_table.id", array())->where("link.queue_id = ? ", $queue->getId());
     $this->_queueJoinedFlag = true;
     return $this;
 }
开发者ID:CherylMuniz,项目名称:fashion,代码行数:12,代码来源:Collection.php

示例8: received

 /**
  * 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;
 }
开发者ID:relue,项目名称:magento2,代码行数:20,代码来源:Subscriber.php

示例9: newsletterQueueSaveBefore

 /**
  * Limit newsletter queue save
  *
  * @param Mage_Newsletter_Model_Queue $model
  */
 public function newsletterQueueSaveBefore($model)
 {
     // force to assign to SV
     $storeIds = $model->getStores();
     if (!$storeIds || !$this->_role->hasStoreAccess($storeIds)) {
         Mage::throwException(Mage::helper('enterprise_admingws')->__('Please assign this entity to a store view.'));
     }
     // make sure disallowed store ids won't be modified
     $originalStores = $model->getResource()->getStores($model);
     $model->setStores($this->_updateSavingStoreIds($storeIds, $originalStores));
 }
开发者ID:beejhuff,项目名称:magento-1.13.0.2,代码行数:16,代码来源:Models.php

示例10: Mage_Newsletter_Model_Template

 * 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__ . '/template.php';
require __DIR__ . '/subscribers.php';
$template = new Mage_Newsletter_Model_Template();
$template->load('fixture_tpl', 'template_code');
$templateId = $template->getId();
$currentStore = Mage::app()->getStore()->getId();
$otherStore = Mage::app()->getStore('fixturestore')->getId();
$queue = new Mage_Newsletter_Model_Queue();
$queue->setTemplateId($templateId)->setNewsletterText('{{skin url="images/logo.gif"}}')->setNewsletterSubject('Subject')->setNewsletterSenderName('CustomerSupport')->setNewsletterSenderEmail('support@example.com')->setQueueStatus(Mage_Newsletter_Model_Queue::STATUS_NEVER)->setQueueStartAtByString(0)->setStores(array($currentStore, $otherStore))->save();
开发者ID:nemphys,项目名称:magento2,代码行数:31,代码来源:queue.php

示例11: _construct

 protected function _construct()
 {
     parent::_construct();
 }
开发者ID:webmaster4world,项目名称:manual-indexing,代码行数:4,代码来源:Queue.php

示例12: _construct

 protected function _construct()
 {
     parent::_construct();
     $this->_init('advancednewsletter/queue');
 }
开发者ID:xiaoguizhidao,项目名称:magento,代码行数:5,代码来源:Queue.php


注:本文中的Mage_Newsletter_Model_Queue类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。