diff --git a/app/code/Magento/Checkout/Model/DefaultConfigProvider.php b/app/code/Magento/Checkout/Model/DefaultConfigProvider.php
index 88c75e5157fe9..85065599341c1 100644
--- a/app/code/Magento/Checkout/Model/DefaultConfigProvider.php
+++ b/app/code/Magento/Checkout/Model/DefaultConfigProvider.php
@@ -281,10 +281,12 @@ public function getConfig()
$quote = $this->checkoutSession->getQuote();
$quoteId = $quote->getId();
$email = $quote->getShippingAddress()->getEmail();
+ $quoteItemData = $this->getQuoteItemData();
$output['formKey'] = $this->formKey->getFormKey();
$output['customerData'] = $this->getCustomerData();
$output['quoteData'] = $this->getQuoteData();
- $output['quoteItemData'] = $this->getQuoteItemData();
+ $output['quoteItemData'] = $quoteItemData;
+ $output['quoteMessages'] = $this->getQuoteItemsMessages($quoteItemData);
$output['isCustomerLoggedIn'] = $this->isCustomerLoggedIn();
$output['selectedShippingMethod'] = $this->getSelectedShippingMethod();
if ($email && !$this->isCustomerLoggedIn()) {
@@ -314,6 +316,7 @@ public function getConfig()
);
$output['postCodes'] = $this->postCodesConfig->getPostCodes();
$output['imageData'] = $this->imageProvider->getImages($quoteId);
+
$output['totalsData'] = $this->getTotalsData();
$output['shippingPolicy'] = [
'isEnabled' => $this->scopeConfig->isSetFlag(
@@ -448,6 +451,7 @@ private function getQuoteItemData()
$quoteItem->getProduct(),
'product_thumbnail_image'
)->getUrl();
+ $quoteItemData[$index]['message'] = $quoteItem->getMessage();
}
}
return $quoteItemData;
@@ -759,4 +763,22 @@ private function getAttributeLabels(array $customAttribute, string $customAttrib
return $attributeOptionLabels;
}
+
+ /**
+ * Get notification messages for the quote items
+ *
+ * @param array $quoteItemData
+ * @return array
+ */
+ private function getQuoteItemsMessages(array $quoteItemData): array
+ {
+ $quoteItemsMessages = [];
+ if ($quoteItemData) {
+ foreach ($quoteItemData as $item) {
+ $quoteItemsMessages[$item['item_id']] = $item['message'];
+ }
+ }
+
+ return $quoteItemsMessages;
+ }
}
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml
index d158bdef6e16a..374ce8dbb425c 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml
@@ -77,6 +77,7 @@
+
diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_index_index.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_index_index.xml
index 6c562f0b9027b..642fb5664ddc0 100644
--- a/app/code/Magento/Checkout/view/frontend/layout/checkout_index_index.xml
+++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_index_index.xml
@@ -404,6 +404,10 @@
- Magento_Checkout/js/view/summary/item/details/subtotal
- after_details
+ -
+
- Magento_Checkout/js/view/summary/item/details/message
+ - item_message
+
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/summary/item/details/message.js b/app/code/Magento/Checkout/view/frontend/web/js/view/summary/item/details/message.js
new file mode 100644
index 0000000000000..ed41fd26c47ec
--- /dev/null
+++ b/app/code/Magento/Checkout/view/frontend/web/js/view/summary/item/details/message.js
@@ -0,0 +1,30 @@
+/**
+ * Copyright © Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+define(['uiComponent'], function (Component) {
+ 'use strict';
+
+ var quoteMessages = window.checkoutConfig.quoteMessages;
+
+ return Component.extend({
+ defaults: {
+ template: 'Magento_Checkout/summary/item/details/message'
+ },
+ displayArea: 'item_message',
+ quoteMessages: quoteMessages,
+
+ /**
+ * @param {Object} item
+ * @return {null}
+ */
+ getMessage: function (item) {
+ if (this.quoteMessages[item['item_id']]) {
+ return this.quoteMessages[item['item_id']];
+ }
+
+ return null;
+ }
+ });
+});
diff --git a/app/code/Magento/Checkout/view/frontend/web/template/summary/item/details.html b/app/code/Magento/Checkout/view/frontend/web/template/summary/item/details.html
index dd59bd78416c6..2491ee12d263c 100644
--- a/app/code/Magento/Checkout/view/frontend/web/template/summary/item/details.html
+++ b/app/code/Magento/Checkout/view/frontend/web/template/summary/item/details.html
@@ -43,3 +43,6 @@
+
+
+
diff --git a/app/code/Magento/Checkout/view/frontend/web/template/summary/item/details/message.html b/app/code/Magento/Checkout/view/frontend/web/template/summary/item/details/message.html
new file mode 100644
index 0000000000000..ea8f58cccd595
--- /dev/null
+++ b/app/code/Magento/Checkout/view/frontend/web/template/summary/item/details/message.html
@@ -0,0 +1,9 @@
+
+
diff --git a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_order-summary.less b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_order-summary.less
index 5ecc4d4713bf1..9bad9518f5724 100644
--- a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_order-summary.less
+++ b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_order-summary.less
@@ -137,6 +137,10 @@
}
.product-item {
+ .product-item-details {
+ &:extend(.abs-add-clearfix all);
+ }
+
.product-item-inner {
display: table;
margin: 0 0 @indent__s;
@@ -166,6 +170,10 @@
}
}
}
+
+ .message {
+ margin-top: 10px;
+ }
}
.actions-toolbar {
diff --git a/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php b/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php
index a1c7333f41245..5e54a9441d1a1 100644
--- a/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php
+++ b/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php
@@ -48,6 +48,13 @@ class TransportBuilder
*/
protected $templateOptions;
+ /**
+ * Mail from address
+ *
+ * @var string|array
+ */
+ private $from;
+
/**
* Mail Transport
*
@@ -178,8 +185,7 @@ public function setReplyTo($email, $name = null)
*/
public function setFrom($from)
{
- $result = $this->_senderResolver->resolve($from);
- $this->message->setFrom($result['email'], $result['name']);
+ $this->from = $from;
return $this;
}
@@ -256,6 +262,7 @@ protected function reset()
$this->templateIdentifier = null;
$this->templateVars = null;
$this->templateOptions = null;
+ $this->from = null;
return $this;
}
@@ -289,6 +296,14 @@ protected function prepareMessage()
->setBody($body)
->setSubject(html_entity_decode($template->getSubject(), ENT_QUOTES));
+ if ($this->from) {
+ $from = $this->_senderResolver->resolve(
+ $this->from,
+ $template->getDesignConfig()->getStore()
+ );
+ $this->message->setFrom($from['email'], $from['name']);
+ }
+
return $this;
}
}
diff --git a/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php b/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php
index c3759bc43f81f..0bbfb37356caa 100644
--- a/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php
+++ b/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php
@@ -7,6 +7,7 @@
namespace Magento\Framework\Mail\Test\Unit\Template;
use Magento\Framework\App\TemplateTypesInterface;
+use Magento\Framework\DataObject;
use Magento\Framework\Mail\MessageInterface;
/**
@@ -99,17 +100,37 @@ protected function setUp()
*/
public function testGetTransport($templateType, $messageType, $bodyText, $templateNamespace)
{
- $this->builder->setTemplateModel($templateNamespace);
-
$vars = ['reason' => 'Reason', 'customer' => 'Customer'];
$options = ['area' => 'frontend', 'store' => 1];
+ $from = 'email_from';
+ $sender = ['email' => 'from@example.com', 'name' => 'name'];
- $template = $this->createMock(\Magento\Framework\Mail\TemplateInterface::class);
+ $this->builder->setTemplateModel($templateNamespace);
+ $this->builder->setFrom($from);
+
+ $template = $this->createPartialMock(
+ \Magento\Framework\Mail\TemplateInterface::class,
+ [
+ 'setVars',
+ 'isPlain',
+ 'setOptions',
+ 'getSubject',
+ 'getType',
+ 'processTemplate',
+ 'getDesignConfig',
+ ]
+ );
$template->expects($this->once())->method('setVars')->with($this->equalTo($vars))->willReturnSelf();
$template->expects($this->once())->method('setOptions')->with($this->equalTo($options))->willReturnSelf();
$template->expects($this->once())->method('getSubject')->willReturn('Email Subject');
$template->expects($this->once())->method('getType')->willReturn($templateType);
$template->expects($this->once())->method('processTemplate')->willReturn($bodyText);
+ $template->method('getDesignConfig')->willReturn(new DataObject($options));
+
+ $this->senderResolverMock->expects($this->once())
+ ->method('resolve')
+ ->with($from, 1)
+ ->willReturn($sender);
$this->templateFactoryMock->expects($this->once())
->method('get')
@@ -128,6 +149,9 @@ public function testGetTransport($templateType, $messageType, $bodyText, $templa
->method('setBody')
->with($this->equalTo($bodyText))
->willReturnSelf();
+ $this->messageMock->method('setFrom')
+ ->with($sender['email'], $sender['name'])
+ ->willReturnSelf();
$transport = $this->createMock(\Magento\Framework\Mail\TransportInterface::class);
@@ -161,24 +185,6 @@ public function getTransportDataProvider()
];
}
- /**
- * @return void
- */
- public function testSetFrom()
- {
- $sender = ['email' => 'from@example.com', 'name' => 'name'];
- $this->senderResolverMock->expects($this->once())
- ->method('resolve')
- ->with($sender)
- ->willReturn($sender);
- $this->messageMock->expects($this->once())
- ->method('setFrom')
- ->with('from@example.com', 'name')
- ->willReturnSelf();
-
- $this->builder->setFrom($sender);
- }
-
/**
* @return void
*/