本文整理汇总了PHP中Magento\Sales\Model\Order::sendNewOrderEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP Order::sendNewOrderEmail方法的具体用法?PHP Order::sendNewOrderEmail怎么用?PHP Order::sendNewOrderEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Sales\Model\Order
的用法示例。
在下文中一共展示了Order::sendNewOrderEmail方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
/**
* Send email about new order.
* Process mail exception
*
* @param Order $order
* @return bool
*/
public function send(Order $order)
{
try {
$order->sendNewOrderEmail();
} catch (\Magento\Framework\Mail\Exception $exception) {
$this->logger->logException($exception);
$this->messageManager->addWarning(__('You did not email your customer. Please check your email settings.'));
return false;
}
return true;
}
示例2: _registerPaymentAuthorization
/**
* Register authorized payment
*
* @return void
*/
protected function _registerPaymentAuthorization()
{
/** @var $payment \Magento\Sales\Model\Order\Payment */
$payment = $this->_order->getPayment();
if ($this->_order->canFetchPaymentReviewUpdate()) {
$payment->registerPaymentReviewAction(\Magento\Sales\Model\Order\Payment::REVIEW_ACTION_UPDATE, true);
} else {
$this->_importPaymentInformation();
$payment->setPreparedMessage($this->_createIpnComment(''))->setTransactionId($this->getRequestData('txn_id'))->setParentTransactionId($this->getRequestData('parent_txn_id'))->setIsTransactionClosed(0)->registerAuthorizationNotification($this->getRequestData('mc_gross'));
}
if (!$this->_order->getEmailSent()) {
$this->_order->sendNewOrderEmail();
}
$this->_order->save();
}
示例3: _processOrder
/**
* Operate with order using information from silent post
*
* @param \Magento\Sales\Model\Order $order
* @return void
* @throws \Magento\Framework\Model\Exception
*/
protected function _processOrder(\Magento\Sales\Model\Order $order)
{
$response = $this->getResponse();
$payment = $order->getPayment();
$payment->setTransactionId($response->getPnref())->setIsTransactionClosed(0);
$canSendNewOrderEmail = true;
if ($response->getResult() == self::RESPONSE_CODE_FRAUDSERVICE_FILTER || $response->getResult() == self::RESPONSE_CODE_DECLINED_BY_FILTER) {
$canSendNewOrderEmail = false;
$fraudMessage = $this->_getFraudMessage() ? $response->getFraudMessage() : $response->getRespmsg();
$payment->setIsTransactionPending(true)->setIsFraudDetected(true)->setAdditionalInformation('paypal_fraud_filters', $fraudMessage);
}
if ($response->getAvsdata() && strstr(substr($response->getAvsdata(), 0, 2), 'N')) {
$payment->setAdditionalInformation('paypal_avs_code', substr($response->getAvsdata(), 0, 2));
}
if ($response->getCvv2match() && $response->getCvv2match() != 'Y') {
$payment->setAdditionalInformation('paypal_cvv2_match', $response->getCvv2match());
}
switch ($response->getType()) {
case self::TRXTYPE_AUTH_ONLY:
$payment->registerAuthorizationNotification($payment->getBaseAmountAuthorized());
break;
case self::TRXTYPE_SALE:
$payment->registerCaptureNotification($payment->getBaseAmountAuthorized());
break;
default:
break;
}
$order->save();
try {
if ($canSendNewOrderEmail) {
$order->sendNewOrderEmail();
}
$this->_quoteFactory->create()->load($order->getQuoteId())->setIsActive(false)->save();
} catch (\Exception $e) {
throw new \Magento\Framework\Model\Exception(__('We cannot send the new order email.'));
}
}