Advertisement
Guest User

Untitled

a guest
Jul 1st, 2015
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.71 KB | None | 0 0
  1. <tr class="summary-details-1 summary-details summary-details-first">
  2.  
  3. <sales_email_order_items>
  4. <reference name="order_totals">
  5. <reference name="tax">
  6. <action method="setTemplate"><template>tax/order/tax-email.phtml</template></action>
  7. </reference>
  8. </reference>
  9. </sales_email_order_items>
  10.  
  11. ...
  12. global $taxIter; $taxIter++;
  13. ...
  14.  
  15. ...
  16. $taxIter=0; $taxIter++;
  17. ...
  18.  
  19. public function send($email, $name = null, array $variables = array())
  20. {
  21. if (!$this->isValidForSend()) {
  22. Mage::logException(new Exception('This letter cannot be sent.')); // translation is intentionally omitted
  23. return false;
  24. }
  25.  
  26. $emails = array_values((array)$email);
  27. $names = is_array($name) ? $name : (array)$name;
  28. $names = array_values($names);
  29. foreach ($emails as $key => $email) {
  30. if (!isset($names[$key])) {
  31. $names[$key] = substr($email, 0, strpos($email, '@'));
  32. }
  33. }
  34.  
  35. $variables['email'] = reset($emails);
  36. $variables['name'] = reset($names);
  37.  
  38. $this->setUseAbsoluteLinks(true);
  39. $text = $this->getProcessedTemplate($variables, true);
  40. $subject = $this->getProcessedTemplateSubject($variables);
  41.  
  42. $setReturnPath = Mage::getStoreConfig(self::XML_PATH_SENDING_SET_RETURN_PATH);
  43. switch ($setReturnPath) {
  44. case 1:
  45. $returnPathEmail = $this->getSenderEmail();
  46. break;
  47. case 2:
  48. $returnPathEmail = Mage::getStoreConfig(self::XML_PATH_SENDING_RETURN_PATH_EMAIL);
  49. break;
  50. default:
  51. $returnPathEmail = null;
  52. break;
  53. }
  54.  
  55. if ($this->hasQueue() && $this->getQueue() instanceof Mage_Core_Model_Email_Queue) {
  56. /** @var $emailQueue Mage_Core_Model_Email_Queue */
  57. $emailQueue = $this->getQueue();
  58. $emailQueue->setMessageBody($text);
  59. $emailQueue->setMessageParameters(array(
  60. 'subject' => $subject,
  61. 'return_path_email' => $returnPathEmail,
  62. 'is_plain' => $this->isPlain(),
  63. 'from_email' => $this->getSenderEmail(),
  64. 'from_name' => $this->getSenderName(),
  65. 'reply_to' => $this->getMail()->getReplyTo(),
  66. 'return_to' => $this->getMail()->getReturnPath(),
  67. ))
  68. ->addRecipients($emails, $names, Mage_Core_Model_Email_Queue::EMAIL_TYPE_TO)
  69. ->addRecipients($this->_bccEmails, array(), Mage_Core_Model_Email_Queue::EMAIL_TYPE_BCC);
  70. $emailQueue->addMessageToQueue();
  71.  
  72. return true;
  73. }
  74.  
  75. ...
  76. }
  77.  
  78. ->addRecipients($emails, $names, Mage_Core_Model_Email_Queue::EMAIL_TYPE_TO)
  79.  
  80. $emailQueue->addMessageToQueue();
  81.  
  82. public function wasEmailQueued(Mage_Core_Model_Email_Queue $queue)
  83. {
  84. $readAdapter = $this->_getReadAdapter();
  85. $select = $readAdapter->select()
  86. ->from(
  87. array('recips' => $this->getTable('core/email_recipients')),
  88. array('recipient_email', 'recipient_name', 'email_type')
  89. )
  90. ->join(array('queue' => $this->getMainTable()), 'queue.message_id = recips.message_id', array())
  91. ->where('queue.entity_id =? ', $queue->getEntityId())
  92. ->where('queue.entity_type =? ', $queue->getEntityType())
  93. ->where('queue.event_type =? ', $queue->getEventType())
  94. ->where('queue.message_body_hash =? ', md5($queue->getMessageBody()));
  95.  
  96. $existingRecipients = $readAdapter->fetchAll($select);
  97. if ($existingRecipients) {
  98. ...
  99. $queue->clearRecipients();
  100. foreach ($diff as $recipient) {
  101. list($email, $name, $type) = $recipient;
  102. $queue->addRecipients($email, $name, $type);
  103. }
  104. ...
  105. }
  106.  
  107. return false;
  108. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement