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


PHP Mage_Sales_Model_Order_Invoice::sendEmail方法代码示例

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


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

示例1: testSendEmail

 /**
  * @magentoConfigFixture sales_email/invoice/enabled 1
  * @magentoConfigFixture current_store design/theme/full_name default/default/default
  * @magentoDataFixture Mage/Sales/_files/order.php
  */
 public function testSendEmail()
 {
     $order = new Mage_Sales_Model_Order();
     $order->loadByIncrementId('100000001');
     $order->setCustomerEmail('customer@example.com');
     $invoice = new Mage_Sales_Model_Order_Invoice();
     $invoice->setOrder($order);
     $paymentInfoBlock = Mage::helper('Mage_Payment_Helper_Data')->getInfoBlock($order->getPayment());
     $paymentInfoBlock->setArea('invalid-area');
     $invoice->setPaymentInfoBlock($paymentInfoBlock);
     $this->assertNull($invoice->getEmailSent());
     $invoice->sendEmail(true);
     $this->assertTrue($invoice->getEmailSent());
     $this->assertEquals('frontend', $paymentInfoBlock->getArea());
 }
开发者ID:nemphys,项目名称:magento2,代码行数:20,代码来源:InvoiceTest.php

示例2: processInvoice

 /**
  * Set capture transaction ID and enable Void to invoice for informational purposes
  * @param Mage_Sales_Model_Order_Invoice $invoice
  * @param Mage_Sales_Model_Order_Payment $payment
  * @return Mage_Payment_Model_Method_Abstract
  */
 public function processInvoice($invoice, $payment)
 {
     if ($payment->getLastTransId()) {
         $invoice->setTransactionId($payment->getLastTransId());
         $invoice->setCanVoidFlag(true);
         if (Mage::helper('sales')->canSendNewInvoiceEmail($payment->getOrder()->getStoreId())) {
             $invoice->setEmailSent(true);
             $invoice->sendEmail();
         }
         return $this;
     }
     return false;
 }
开发者ID:rorteg,项目名称:rafaelmage,代码行数:19,代码来源:Standard.php

示例3: _sendEmails

 /**
  * Send appropriate emails to customer based on configuration.
  * see MageBase_DpsPaymentExpress_Model_System_Invoiceconfig for the config options
  *
  * @param Mage_Sales_Model_Order         $order
  * @param Mage_Sales_Model_Order_Invoice $invoice
  */
 protected function _sendEmails($order, $invoice)
 {
     switch (Mage::getStoreConfig('payment/' . $this->_code . '/emailstosend', $this->getStore())) {
         case MageBase_DpsPaymentExpress_Model_Method_Common::EMAIL_SEND_INVOICE:
             // send invoice email only
             $invoice->sendEmail();
             break;
         case MageBase_DpsPaymentExpress_Model_Method_Common::EMAIL_SEND_BOTH:
             // send both
             $order->sendNewOrderEmail();
             $invoice->sendEmail();
             break;
         case MageBase_DpsPaymentExpress_Model_Method_Common::EMAIL_SEND_ORDER:
             // default - send order email only
         // default - send order email only
         default:
             $order->sendNewOrderEmail();
             break;
     }
 }
开发者ID:mVentory,项目名称:magebase_paymentexpress,代码行数:27,代码来源:Pxpay.php

示例4: sendInvoiceToCustomer

 /**
  * send invoice to customer if that was configured by the merchant
  *
  * @param Mage_Sales_Model_Order_Invoice $invoice Invoice to be sent
  *
  * @return void
  */
 public function sendInvoiceToCustomer(Mage_Sales_Model_Order_Invoice $invoice)
 {
     if (false == $invoice->getEmailSent() && $this->getConfig()->getSendInvoice()) {
         $invoice->sendEmail($notifyCustomer = true);
     }
 }
开发者ID:roshu1980,项目名称:add-computers,代码行数:13,代码来源:Payment.php

示例5: sendInvoiceEmail

 /**
  * @param Mage_Sales_Model_Order_Invoice $invoice
  */
 protected function sendInvoiceEmail(Mage_Sales_Model_Order_Invoice $invoice)
 {
     $invoice->setEmailSent(true);
     $invoice->sendEmail();
     $invoice->save();
 }
开发者ID:vberzsin,项目名称:shop,代码行数:9,代码来源:InvoiceCreate.php

示例6: sendEmail

 /**
  * Send email with invoice data
  *
  * @param boolean $notifyCustomer
  * @param string $comment
  * @return Mage_Sales_Model_Order_Invoice
  */
 public function sendEmail($notifyCustomer = true, $comment = '')
 {
     if (!Mage::getStoreConfig('pdfpro/config/enabled')) {
         return parent::sendEmail($notifyCustomer, $comment);
     }
     switch (Mage::getStoreConfig('pdfpro/config/invoice_email_attach')) {
         case VES_PdfPro_Model_Source_Attach::ATTACH_TYPE_NO:
             return parent::sendEmail();
         case VES_PdfPro_Model_Source_Attach::ATTACH_TYPE_ADMIN:
             $this->sendEmailForAdmin($notifyCustomer, $comment, true);
             $this->sendEmailForCustomer($notifyCustomer, $comment, false);
             return $this;
         case VES_PdfPro_Model_Source_Attach::ATTACH_TYPE_CUSTOMER:
             $this->sendEmailForAdmin($notifyCustomer, $comment, false);
             $this->sendEmailForCustomer($notifyCustomer, $comment, true);
             return $this;
     }
     $order = $this->getOrder();
     $storeId = $order->getStore()->getId();
     if (!Mage::helper('sales')->canSendNewInvoiceEmail($storeId)) {
         return $this;
     }
     // Get the destination email addresses to send copies to
     $copyTo = $this->_getEmails(self::XML_PATH_EMAIL_COPY_TO);
     $copyMethod = Mage::getStoreConfig(self::XML_PATH_EMAIL_COPY_METHOD, $storeId);
     // Check if at least one recepient is found
     if (!$notifyCustomer && !$copyTo) {
         return $this;
     }
     // Start store emulation process
     $appEmulation = Mage::getSingleton('pdfpro/app_emulation');
     if ($appEmulation) {
         $initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);
     }
     try {
         // Retrieve specified view block from appropriate design package (depends on emulated store)
         $paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment())->setIsSecureMode(true);
         $paymentBlock->getMethod()->setStore($storeId);
         $paymentBlockHtml = $paymentBlock->toHtml();
     } catch (Exception $exception) {
         // Stop store emulation process
         if ($appEmulation) {
             $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
         }
         throw $exception;
     }
     // Stop store emulation process
     if ($appEmulation) {
         $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
     }
     // Retrieve corresponding email template id and customer name
     if ($order->getCustomerIsGuest()) {
         $templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_GUEST_TEMPLATE, $storeId);
         $customerName = $order->getBillingAddress()->getName();
     } else {
         $templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE, $storeId);
         $customerName = $order->getCustomerName();
     }
     $mailer = Mage::getModel('pdfpro/email_template_mailer');
     if ($notifyCustomer) {
         $emailInfo = Mage::getModel('pdfpro/email_info');
         $emailInfo->addTo($order->getCustomerEmail(), $customerName);
         if ($copyTo && $copyMethod == 'bcc') {
             // Add bcc to customer email
             foreach ($copyTo as $email) {
                 $emailInfo->addBcc($email);
             }
         }
         $mailer->addEmailInfo($emailInfo);
     }
     // Email copies are sent as separated emails if their copy method is 'copy' or a customer should not be notified
     if ($copyTo && ($copyMethod == 'copy' || !$notifyCustomer)) {
         foreach ($copyTo as $email) {
             $emailInfo = Mage::getModel('pdfpro/email_info');
             $emailInfo->addTo($email);
             $mailer->addEmailInfo($emailInfo);
         }
     }
     // Set all required params and send emails
     $mailer->setSender(Mage::getStoreConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId));
     $mailer->setStoreId($storeId);
     $mailer->setTemplateId($templateId);
     $mailer->setTemplateParams(array('order' => $order, 'invoice' => $this, 'comment' => $comment, 'billing' => $order->getBillingAddress(), 'payment_html' => $paymentBlockHtml));
     /* Attach Invoice PDF in email */
     $invoiceData = Mage::getModel('pdfpro/order_invoice')->initInvoiceData($this);
     try {
         $result = Mage::helper('pdfpro')->initPdf(array($invoiceData));
         if ($result['success']) {
             $mailer->setPdf(array('filename' => Mage::helper('pdfpro')->getFileName('invoice', $this) . '.pdf', 'content' => $result['content']));
         } else {
             Mage::log($result['msg']);
         }
     } catch (Exception $e) {
//.........这里部分代码省略.........
开发者ID:uibar,项目名称:peggysgift,代码行数:101,代码来源:Invoice.php


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