Skip to content

Commit 088c0b5

Browse files
committed
ACP2E-1419: [Magento Cloud] - Error image in phtml for back to stock email
- Fixed the issue.
1 parent f05364e commit 088c0b5

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

app/code/Magento/ProductAlert/Model/Mailing/AlertProcessor.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Magento\ProductAlert\Model\Mailing;
99

10+
use Magento\Framework\App\Area;
1011
use Magento\Catalog\Api\Data\ProductInterface;
1112
use Magento\Catalog\Api\ProductRepositoryInterface;
1213
use Magento\Catalog\Helper\Data;
@@ -24,6 +25,8 @@
2425
use Magento\Store\Api\Data\WebsiteInterface;
2526
use Magento\Store\Model\StoreManagerInterface;
2627
use Magento\Store\Model\Website;
28+
use Magento\Framework\App\ObjectManager;
29+
use Magento\Framework\View\DesignInterface;
2730

2831
/**
2932
* Class for mailing Product Alerts
@@ -78,6 +81,11 @@ class AlertProcessor
7881
*/
7982
private $errorEmailSender;
8083

84+
/**
85+
* @var DesignInterface
86+
*/
87+
private $design;
88+
8189
/**
8290
* @param EmailFactory $emailFactory
8391
* @param PriceCollectionFactory $priceCollectionFactory
@@ -88,6 +96,7 @@ class AlertProcessor
8896
* @param ProductSalability $productSalability
8997
* @param StoreManagerInterface $storeManager
9098
* @param ErrorEmailSender $errorEmailSender
99+
* @param DesignInterface|null $design
91100
*/
92101
public function __construct(
93102
EmailFactory $emailFactory,
@@ -98,7 +107,8 @@ public function __construct(
98107
Data $catalogData,
99108
ProductSalability $productSalability,
100109
StoreManagerInterface $storeManager,
101-
ErrorEmailSender $errorEmailSender
110+
ErrorEmailSender $errorEmailSender,
111+
DesignInterface $design = null
102112
) {
103113
$this->emailFactory = $emailFactory;
104114
$this->priceCollectionFactory = $priceCollectionFactory;
@@ -109,6 +119,8 @@ public function __construct(
109119
$this->productSalability = $productSalability;
110120
$this->storeManager = $storeManager;
111121
$this->errorEmailSender = $errorEmailSender;
122+
$this->design = $design ?: ObjectManager::getInstance()
123+
->get(DesignInterface::class);
112124
}
113125

114126
/**
@@ -142,6 +154,12 @@ public function process(string $alertType, array $customerIds, int $websiteId):
142154
*/
143155
private function processAlerts(string $alertType, array $customerIds, int $websiteId): array
144156
{
157+
//Set the current design theme
158+
$this->design->setDesignTheme(
159+
$this->design->getConfigurationDesignTheme(Area::AREA_FRONTEND),
160+
Area::AREA_FRONTEND
161+
);
162+
145163
/** @var Email $email */
146164
$email = $this->emailFactory->create();
147165
$email->setType($alertType);

0 commit comments

Comments
 (0)