本文整理汇总了PHP中Mage_Newsletter_Model_Queue::getStores方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Newsletter_Model_Queue::getStores方法的具体用法?PHP Mage_Newsletter_Model_Queue::getStores怎么用?PHP Mage_Newsletter_Model_Queue::getStores使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Newsletter_Model_Queue
的用法示例。
在下文中一共展示了Mage_Newsletter_Model_Queue::getStores方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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('newsletter/subscriber_collection')->addFieldToFilter('store_id', array('in' => $stores))->useOnlySubscribed()->load();
$subscriberIds = array();
foreach ($subscribers as $subscriber) {
$subscriberIds[] = $subscriber->getId();
}
if (count($subscriberIds) > 0) {
$this->addSubscribersToQueue($queue, $subscriberIds);
}
return $this;
}
示例2: 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));
}