本文整理汇总了PHP中Mage_Core_Model_Email_Template::sendTransactional方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Email_Template::sendTransactional方法的具体用法?PHP Mage_Core_Model_Email_Template::sendTransactional怎么用?PHP Mage_Core_Model_Email_Template::sendTransactional使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_Email_Template
的用法示例。
在下文中一共展示了Mage_Core_Model_Email_Template::sendTransactional方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendTransactional
/**
* Send transactional email to recipient
*
* @see Mage_Core_Model_Email_Template::sendTransactional()
* @param string $templateId
* @param string|array $sender sneder information, can be declared as part of config path
* @param string $email recipient email
* @param string $name recipient name
* @param array $vars varianles which can be used in template
* @param int|null $storeId
* @return Mage_Core_Model_Email_Template
*/
public function sendTransactional($templateId, $sender, $email, $name, $vars = array(), $storeId = null)
{
$this->_templateId = $templateId;
$sendType = Mage::helper('connector/transactional')->getMapping($templateId, Dotdigitalgroup_Email_Helper_Transactional::MAP_COLUMN_KEY_SENDTYPE, $storeId);
$transEnabled = Mage::getStoreConfig(Dotdigitalgroup_Email_Helper_Transactional::XML_PATH_TRANSACTIONAL_API_ENABLED, $storeId);
$campaignId = Mage::helper('connector/transactional')->getMapping($templateId, Dotdigitalgroup_Email_Helper_Transactional::MAP_COLUMN_KEY_DATAFIELD, $storeId);
//design and send. campaign id is needed for this option
if ($sendType == 2 && $transEnabled && $campaignId) {
if (is_array($email)) {
foreach ($email as $one) {
$this->setSentSuccess($this->designAndSend($templateId, $vars, $campaignId, $one, $storeId));
}
} else {
$this->setSentSuccess($this->designAndSend($templateId, $vars, $campaignId, $email, $storeId));
}
return $this;
}
//send via connector
if ($sendType == 1 && $transEnabled) {
return $this->sendTransactionalForOptionViaConnector($sender, $email, $name, $vars, $storeId, $sendType);
}
// If Template ID is 'nosend', then simply return false
if ($templateId == 'nosend') {
return false;
}
//templates not mapped or mapped "Use System Default"
return parent::sendTransactional($templateId, $sender, $email, $name, $vars, $storeId);
}
示例2: sendTransactional
/**
* Send transactional email to recipient
*
* @see Mage_Core_Model_Email_Template::sendTransactional()
* @param string $templateId
* @param string|array $sender sneder information, can be declared as part of config path
* @param string $email recipient email
* @param string $name recipient name
* @param array $vars varianles which can be used in template
* @param int|null $storeId
* @return Mage_Core_Model_Email_Template
*/
public function sendTransactional($templateId, $sender, $email, $name, $vars = array(), $storeId = null)
{
if (!Mage::helper('wfs_disable_emails')->isDisabled($templateId)) {
return parent::sendTransactional($templateId, $sender, $email, $name, $vars, $storeId);
} else {
$this->setSentSuccess(true);
return $this;
}
}
示例3: sendTransactional
public function sendTransactional($templateId, $sender, $email, $name, $vars = array(), $storeId = null)
{
if (isset($vars['order']) && !isset($vars['dealer'])) {
$order = $vars['order'];
$dealerId = Mage::getModel('amperm/perm')->getUserByOrder($order->getId());
if ($dealerId) {
$user = Mage::getModel('admin/user')->load($dealerId);
$vars['dealer'] = $user;
}
}
return parent::sendTransactional($templateId, $sender, $email, $name, $vars, $storeId);
}
示例4: sendTransactional
public function sendTransactional($templateId, $sender, $email, $name, $vars = array(), $storeId = null)
{
if (isset($vars['order']) && !isset($vars['customer'])) {
// will try to add customer object
$order = $vars['order'];
if ($order->getCustomerId()) {
$customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
if ($customer->getId()) {
$vars['customer'] = $customer;
}
}
}
return parent::sendTransactional($templateId, $sender, $email, $name, $vars, $storeId);
}
示例5: sendTransactional
/**
* Send transactional email to recipient
*
* @param int $templateId
* @param string|array $sender sneder informatio, can be declared as part of config path
* @param string $email recipient email
* @param string $name recipient name
* @param array $vars varianles which can be used in template
* @param int|null $storeId
* @return Mage_Core_Model_Email_Template
*/
public function sendTransactional($templateId, $sender, $email, $name, $vars = array(), $storeId = null)
{
if (isset($vars['order'])) {
$aCustomAtrrList = $this->_getCustomAttributesList($vars);
$cfm = new Varien_Object();
foreach ($aCustomAtrrList as $attr) {
if (!isset($attr['attribute_code']) && isset($attr['code'])) {
$attr['attribute_code'] = $attr['code'];
}
$cfm->setData($attr['attribute_code'], $attr['value']);
if ($attr['value'] && isset($attr['frontend_label'])) {
$cfm->setData($attr['attribute_code'] . '_label', $attr['frontend_label']);
}
}
$vars['cfm'] = $cfm;
}
return parent::sendTransactional($templateId, $sender, $email, $name, $vars, $storeId);
}
示例6: sendTransactional
public function sendTransactional($templateId, $sender, $email, $name, $vars = array(), $storeId = null)
{
$templatePath = Mage::helper('aitemails')->getPathByEmailTemplateCode('sales_email_order_template');
$collection = Mage::getResourceSingleton('aitemails/aittemplate_collection');
$aCollection = $collection->load()->toArray();
$aCollection = $aCollection['items'];
$this->load($templateId);
foreach ($aCollection as $template) {
$templatePath = Mage::helper('aitemails')->getPathByEmailTemplateCode($template['code']);
if (!$this->getId() && is_numeric($templateId)) {
$config_value = Mage::getStoreConfig($templatePath);
if ($config_value == $templateId) {
$templateId = $template['code'];
}
}
}
$this->setAitmailsStoreId($storeId);
return parent::sendTransactional($templateId, $sender, $email, $name, $vars, $storeId);
}
示例7: sendReminderEmails
/**
* Send reminder emails
*
* @return Enterprise_Reminder_Model_Rule
*/
public function sendReminderEmails()
{
/* @var $translate Mage_Core_Model_Translate */
$translate = Mage::getSingleton('core/translate');
$translate->setTranslateInline(false);
$identity = Mage::helper('enterprise_reminder')->getEmailIdentity();
$this->_matchCustomers();
$limit = Mage::helper('enterprise_reminder')->getOneRunLimit();
$recipients = $this->_getResource()->getCustomersForNotification($limit, $this->getRuleId());
foreach ($recipients as $recipient) {
/* @var $customer Mage_Customer_Model_Customer */
$customer = Mage::getModel('customer/customer')->load($recipient['customer_id']);
if (!$customer || !$customer->getId()) {
continue;
}
if ($customer->getStoreId()) {
$store = $customer->getStore();
} else {
$store = Mage::app()->getWebsite($customer->getWebsiteId())->getDefaultStore();
}
$storeData = $this->getStoreData($recipient['rule_id'], $store->getId());
if (!$storeData) {
continue;
}
/* @var $coupon Mage_SalesRule_Model_Coupon */
$coupon = Mage::getModel('salesrule/coupon')->load($recipient['coupon_id']);
$templateVars = array('store' => $store, 'coupon' => $coupon, 'customer' => $customer, 'promotion_name' => $storeData['label'], 'promotion_description' => $storeData['description']);
$this->_mail->setDesignConfig(array('area' => 'frontend', 'store' => $store->getId()));
$this->_mail->sendTransactional($storeData['template_id'], $identity, $customer->getEmail(), null, $templateVars, $store->getId());
if ($this->_mail->getSentSuccess()) {
$this->_getResource()->addNotificationLog($recipient['rule_id'], $customer->getId());
} else {
$this->_getResource()->updateFailedEmailsCounter($recipient['rule_id'], $customer->getId());
}
}
$translate->setTranslateInline(true);
return $this;
}
示例8: testSendTransactionalWrongId
/**
* @expectedException Mage_Core_Exception
*/
public function testSendTransactionalWrongId()
{
$this->_model->sendTransactional('wrong_id' . uniqid(), array('name' => 'Sender Name', 'email' => 'sender@example.com'), 'recipient@example.com', 'Recipient Name');
}
示例9: sendTransactional
/**
* Send transactional email to recipient
*
* @param int $templateId
* @param string|array $sender Sender information, can be declared as part of config path
* @param string $email Recipient email
* @param string $name Recipient name
* @param array $vars Variables which can be used in template
* @param int|null $storeId
*
* @return Mage_Core_Model_Email_Template
*/
public function sendTransactional($templateId, $sender, $email, $name, $vars = array(), $storeId = null)
{
// If Template ID is 'nosend', then simply return false
if ($templateId == 'nosend') {
return false;
}
// If not set to go through Bronto, fall through to magento sending
if (!Mage::helper($this->_helper)->canSendBronto($this, $storeId)) {
return parent::sendTransactional($templateId, $sender, $email, $name, $vars, $storeId);
} else {
// If module enabled and template ID is not an instance of the api row, see if we can pull an instance
if (!$templateId instanceof Bronto_Api_Model_Message) {
$emailTemplate = Mage::getModel('bronto_email/template')->setDesignConfig($this->getDesignConfig()->getData());
// If $templateId is numeric, load template by ID, else is default and should send through Magento
if (is_numeric($templateId)) {
$emailTemplate->load($templateId);
} else {
$this->setTemplateSendType('magento');
return parent::sendTransactional($templateId, $sender, $email, $name, $vars, $storeId);
}
// If Template doesn't have a Bronto Message ID, send through magento
if (!$emailTemplate->getBrontoMessageId() || is_null($emailTemplate->getBrontoMessageId())) {
return parent::sendTransactional($templateId, $sender, $email, $name, $vars, $storeId);
}
$message = new Bronto_Api_Model_Message();
$message->withId($emailTemplate->getBrontoMessageId());
// Send through main template model
$emailTemplate->sendTransactional($message, $sender, $email, $name, $vars, $storeId);
return $this->setSentSuccess($emailTemplate->getSentSuccess());
} else {
$this->setBrontoMessageId($templateId->id);
}
}
// Start the send process
$this->setSentSuccess(false);
if ($storeId === null && $this->getDesignConfig()->getStore()) {
$storeId = $this->getDesignConfig()->getStore();
}
// If $sender is not array, it is a reference to a config setting, otherwise it should have 'name' and 'email'
if (!is_array($sender)) {
$this->setSenderName(Mage::getStoreConfig('trans_email/ident_' . $sender . '/name', $storeId));
$this->setSenderEmail(Mage::getStoreConfig('trans_email/ident_' . $sender . '/email', $storeId));
} else {
$this->setSenderName($sender['name']);
$this->setSenderEmail($sender['email']);
}
// If store is not set, set it
if (!isset($vars['store'])) {
$vars['store'] = Mage::app()->getStore($storeId);
}
// Check for Sales Rules
if (!isset($vars['coupon']) && ($rule = $this->_getSalesRule($storeId))) {
try {
/** @var Mage_SalesRule_Model_Coupon $coupon */
$coupon = $rule->acquireCoupon();
if ($coupon) {
$vars['coupon'] = $coupon;
}
} catch (Exception $e) {
Mage::helper($this->_helper)->writeError(' Failed loading Sales Rule with ID: ' . $rule->getId());
}
}
// Send
$this->setSentSuccess($this->send($email, $name, $vars));
return $this;
}