本文整理汇总了PHP中Magento\Quote\Model\Quote::getCustomerEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP Quote::getCustomerEmail方法的具体用法?PHP Quote::getCustomerEmail怎么用?PHP Quote::getCustomerEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Quote\Model\Quote
的用法示例。
在下文中一共展示了Quote::getCustomerEmail方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareQuoteForNewCustomer
/**
* @param \Magento\Quote\Model\Quote $quote
* @return \Magento\Quote\Model\Quote
*/
public function prepareQuoteForNewCustomer(\Magento\Quote\Model\Quote $quote)
{
$billing = $quote->getBillingAddress();
$shipping = $quote->isVirtual() ? null : $quote->getShippingAddress();
$billing->setDefaultBilling(true);
if ($shipping && !$shipping->getSameAsBilling()) {
$shipping->setDefaultShipping(true);
$address = $shipping->exportCustomerAddress();
$shipping->setCustomerAddressData($address);
} elseif ($shipping) {
$billing->setDefaultShipping(true);
}
$address = $shipping->exportCustomerAddress();
$billing->setCustomerAddressData($address);
foreach (['customer_dob', 'customer_taxvat', 'customer_gender'] as $attribute) {
if ($quote->getData($attribute) && !$billing->getData($attribute)) {
$billing->setData($attribute, $quote->getData($attribute));
}
}
$customer = $this->customerFactory->create();
$this->dataObjectHelper->populateWithArray($customer, $this->copyObject->getDataFromFieldset('checkout_onepage_billing', 'to_customer', $billing), '\\Magento\\Customer\\Api\\Data\\CustomerInterface');
$customer->setEmail($quote->getCustomerEmail());
$customer->setPrefix($quote->getCustomerPrefix());
$customer->setFirstname($quote->getCustomerFirstname());
$customer->setMiddlename($quote->getCustomerMiddlename());
$customer->setLastname($quote->getCustomerLastname());
$customer->setSuffix($quote->getCustomerSuffix());
$quote->setCustomer($customer);
$quote->addCustomerAddress($billing->exportCustomerAddress());
if ($shipping->hasCustomerAddress()) {
$quote->addCustomerAddress($shipping->exportCustomerAddress());
}
return $quote;
}
示例2: _validateCustomerDataInQuote
/**
* Ensure that quote has customer data specified in customer fixture.
*
* @param \Magento\Quote\Model\Quote $quote
*/
protected function _validateCustomerDataInQuote($quote)
{
$customerIdFromFixture = 1;
$customerEmailFromFixture = 'customer@example.com';
$customerFirstNameFromFixture = 'John';
$this->assertEquals($customerEmailFromFixture, $quote->getCustomerEmail(), 'Customer email was not set to Quote correctly.');
$this->assertEquals($customerIdFromFixture, $quote->getCustomerId(), 'Customer ID was not set to Quote correctly.');
$this->assertEquals($customerFirstNameFromFixture, $quote->getCustomerFirstname(), 'Customer first name was not set to Quote correctly.');
}
示例3: sendPaymentFailedEmail
/**
* Send email id payment was failed
*
* @param \Magento\Quote\Model\Quote $checkout
* @param string $message
* @param string $checkoutType
* @return $this
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function sendPaymentFailedEmail($checkout, $message, $checkoutType = 'onepage')
{
$this->inlineTranslation->suspend();
$template = $this->scopeConfig->getValue('checkout/payment_failed/template', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $checkout->getStoreId());
$copyTo = $this->_getEmails('checkout/payment_failed/copy_to', $checkout->getStoreId());
$copyMethod = $this->scopeConfig->getValue('checkout/payment_failed/copy_method', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $checkout->getStoreId());
$bcc = [];
if ($copyTo && $copyMethod == 'bcc') {
$bcc = $copyTo;
}
$_receiver = $this->scopeConfig->getValue('checkout/payment_failed/receiver', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $checkout->getStoreId());
$sendTo = [['email' => $this->scopeConfig->getValue('trans_email/ident_' . $_receiver . '/email', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $checkout->getStoreId()), 'name' => $this->scopeConfig->getValue('trans_email/ident_' . $_receiver . '/name', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $checkout->getStoreId())]];
if ($copyTo && $copyMethod == 'copy') {
foreach ($copyTo as $email) {
$sendTo[] = ['email' => $email, 'name' => null];
}
}
$shippingMethod = '';
if ($shippingInfo = $checkout->getShippingAddress()->getShippingMethod()) {
$data = explode('_', $shippingInfo);
$shippingMethod = $data[0];
}
$paymentMethod = '';
if ($paymentInfo = $checkout->getPayment()) {
$paymentMethod = $paymentInfo->getMethod();
}
$items = '';
foreach ($checkout->getAllVisibleItems() as $_item) {
/* @var $_item \Magento\Quote\Model\Quote\Item */
$items .= $_item->getProduct()->getName() . ' x ' . $_item->getQty() . ' ' . $checkout->getStoreCurrencyCode() . ' ' . $_item->getProduct()->getFinalPrice($_item->getQty()) . "\n";
}
$total = $checkout->getStoreCurrencyCode() . ' ' . $checkout->getGrandTotal();
foreach ($sendTo as $recipient) {
$transport = $this->_transportBuilder->setTemplateIdentifier($template)->setTemplateOptions(['area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $checkout->getStoreId()])->setTemplateVars(['reason' => $message, 'checkoutType' => $checkoutType, 'dateAndTime' => $this->_localeDate->formatDateTime(new \DateTime(), \IntlDateFormatter::MEDIUM, \IntlDateFormatter::MEDIUM), 'customer' => $checkout->getCustomerFirstname() . ' ' . $checkout->getCustomerLastname(), 'customerEmail' => $checkout->getCustomerEmail(), 'billingAddress' => $checkout->getBillingAddress(), 'shippingAddress' => $checkout->getShippingAddress(), 'shippingMethod' => $this->scopeConfig->getValue('carriers/' . $shippingMethod . '/title', \Magento\Store\Model\ScopeInterface::SCOPE_STORE), 'paymentMethod' => $this->scopeConfig->getValue('payment/' . $paymentMethod . '/title', \Magento\Store\Model\ScopeInterface::SCOPE_STORE), 'items' => nl2br($items), 'total' => $total])->setFrom($this->scopeConfig->getValue('checkout/payment_failed/identity', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $checkout->getStoreId()))->addTo($recipient['email'], $recipient['name'])->addBcc($bcc)->getTransport();
$transport->sendMessage();
}
$this->inlineTranslation->resume();
return $this;
}
示例4: calculateQuoteChecksum
/**
* calculate quote checksum, it's verified after the return from the payment page
* detect fraud attempts (cart modifications during checkout)
*
* @param \Magento\Quote\Model\Quote $quote
*
* @return string
*/
public function calculateQuoteChecksum($quote)
{
$data = round($quote->getGrandTotal(), $this->getPrecision()) . $quote->getBaseCurrencyCode() . $quote->getCustomerEmail();
foreach ($quote->getAllVisibleItems() as $item) {
/** @var \Magento\Quote\Model\Quote\Item $item */
$data .= $item->getSku();
$data .= round($item->getRowTotal(), $this->getPrecision());
$data .= round($item->getTaxAmount(), $this->getPrecision());
}
$address = $quote->getBillingAddress();
$data .= $address->getName() . $address->getCompany() . $address->getCity() . $address->getPostcode() . $address->getCountryId() . $address->getCountry() . $address->getRegion() . $address->getStreetLine(1) . $address->getStreetLine(2);
$address = $quote->getShippingAddress();
$data .= $address->getName() . $address->getCompany() . $address->getCity() . $address->getPostcode() . $address->getCountryId() . $address->getCountry() . $address->getRegion() . $address->getStreetLine(1) . $address->getStreetLine(2);
return hash_hmac('sha512', $data, $this->getConfigData('basicdata/secret'));
}
示例5: getUserDescription
/**
* Returns desription of customer - will be displayed in Wirecard backend
*
* @param Quote $quote
*
* @return string
*/
protected function getUserDescription($quote)
{
return sprintf('%s %s %s', $quote->getCustomerEmail(), $quote->getCustomerFirstname(), $quote->getCustomerLastname());
}