7
7
8
8
namespace Magento \ProductAlert \Model \Mailing ;
9
9
10
+ use Magento \Framework \App \Area ;
10
11
use Magento \Catalog \Api \Data \ProductInterface ;
11
12
use Magento \Catalog \Api \ProductRepositoryInterface ;
12
13
use Magento \Catalog \Helper \Data ;
24
25
use Magento \Store \Api \Data \WebsiteInterface ;
25
26
use Magento \Store \Model \StoreManagerInterface ;
26
27
use Magento \Store \Model \Website ;
28
+ use Magento \Framework \App \ObjectManager ;
29
+ use Magento \Framework \View \DesignInterface ;
27
30
28
31
/**
29
32
* Class for mailing Product Alerts
@@ -78,6 +81,11 @@ class AlertProcessor
78
81
*/
79
82
private $ errorEmailSender ;
80
83
84
+ /**
85
+ * @var DesignInterface
86
+ */
87
+ private $ design ;
88
+
81
89
/**
82
90
* @param EmailFactory $emailFactory
83
91
* @param PriceCollectionFactory $priceCollectionFactory
@@ -88,6 +96,7 @@ class AlertProcessor
88
96
* @param ProductSalability $productSalability
89
97
* @param StoreManagerInterface $storeManager
90
98
* @param ErrorEmailSender $errorEmailSender
99
+ * @param DesignInterface|null $design
91
100
*/
92
101
public function __construct (
93
102
EmailFactory $ emailFactory ,
@@ -98,7 +107,8 @@ public function __construct(
98
107
Data $ catalogData ,
99
108
ProductSalability $ productSalability ,
100
109
StoreManagerInterface $ storeManager ,
101
- ErrorEmailSender $ errorEmailSender
110
+ ErrorEmailSender $ errorEmailSender ,
111
+ DesignInterface $ design = null
102
112
) {
103
113
$ this ->emailFactory = $ emailFactory ;
104
114
$ this ->priceCollectionFactory = $ priceCollectionFactory ;
@@ -109,6 +119,8 @@ public function __construct(
109
119
$ this ->productSalability = $ productSalability ;
110
120
$ this ->storeManager = $ storeManager ;
111
121
$ this ->errorEmailSender = $ errorEmailSender ;
122
+ $ this ->design = $ design ?: ObjectManager::getInstance ()
123
+ ->get (DesignInterface::class);
112
124
}
113
125
114
126
/**
@@ -142,6 +154,12 @@ public function process(string $alertType, array $customerIds, int $websiteId):
142
154
*/
143
155
private function processAlerts (string $ alertType , array $ customerIds , int $ websiteId ): array
144
156
{
157
+ //Set the current design theme
158
+ $ this ->design ->setDesignTheme (
159
+ $ this ->design ->getConfigurationDesignTheme (Area::AREA_FRONTEND ),
160
+ Area::AREA_FRONTEND
161
+ );
162
+
145
163
/** @var Email $email */
146
164
$ email = $ this ->emailFactory ->create ();
147
165
$ email ->setType ($ alertType );
0 commit comments