本文整理汇总了PHP中Magento\Sales\Model\Order::getCustomerName方法的典型用法代码示例。如果您正苦于以下问题:PHP Order::getCustomerName方法的具体用法?PHP Order::getCustomerName怎么用?PHP Order::getCustomerName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Sales\Model\Order
的用法示例。
在下文中一共展示了Order::getCustomerName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareTemplate
/**
* @param Order $order
* @return void
*/
protected function prepareTemplate(Order $order)
{
$this->templateContainer->setTemplateOptions($this->getTemplateOptions());
if ($order->getCustomerIsGuest()) {
$templateId = $this->identityContainer->getGuestTemplateId();
$customerName = $order->getBillingAddress()->getName();
} else {
$templateId = $this->identityContainer->getTemplateId();
$customerName = $order->getCustomerName();
}
$this->identityContainer->setCustomerName($customerName);
$this->identityContainer->setCustomerEmail($order->getCustomerEmail());
$this->templateContainer->setTemplateId($templateId);
}
示例2: informCustomer
public function informCustomer(\Magento\Sales\Model\Order $order, $amount, $currency)
{
try {
if (!($order_increment_id = $order->getRealOrderId()) or !($method_config = $this->_s2pModel->getFullConfigArray())) {
return false;
}
$siteUrl = $order->getStore()->getBaseUrl();
$siteName = $this->_helper->getStoreName();
$supportEmail = $this->_helper->getStoreConfig('trans_email/ident_support/email');
$supportName = $this->_helper->getStoreConfig('trans_email/ident_support/name');
$payment_details_arr['site_url'] = $siteUrl;
$payment_details_arr['order_increment_id'] = $order_increment_id;
$payment_details_arr['site_name'] = $siteName;
$payment_details_arr['customer_name'] = $order->getCustomerName();
$payment_details_arr['order_date'] = $order->getCreatedAtFormatted(\IntlDateFormatter::LONG);
$payment_details_arr['support_email'] = $supportEmail;
$payment_details_arr['total_paid'] = number_format($amount / 100, 2);
$payment_details_arr['currency'] = $currency;
$transport = $this->_transportBuilder->setTemplateIdentifier($method_config['smart2pay_email_payment_confirmation'])->setTemplateOptions(['area' => \Magento\Framework\App\Area::AREA_ADMINHTML, 'store' => $order->getStore()->getId()])->setTemplateVars($payment_details_arr)->setFrom(['name' => $supportName, 'email' => $supportEmail])->addTo($order->getCustomerEmail())->getTransport();
$transport->sendMessage();
} catch (\Magento\Framework\Exception\MailException $e) {
$this->_s2pLogger->write('Error sending customer informational email to [' . $order->getCustomerEmail() . ']', 'email_template');
$this->_s2pLogger->write($e->getMessage(), 'email_exception');
} catch (\Exception $e) {
$this->_s2pLogger->write($e->getMessage(), 'exception');
}
return true;
}