@@ -145,6 +145,16 @@ public function aroundExecute(\Magento\Review\Controller\Adminhtml\Product\Save
145145 {
146146 $ reviewId = $ object ->getRequest ()->getParam ('id ' );
147147 $ data = $ object ->getRequest ()->getPostValue ();
148+ $ stores = isset ($ data ['stores ' ]) ? $ data ['stores ' ] : [];
149+ $ storeId = \Magento \Store \Model \Store::DEFAULT_STORE_ID ;
150+ if ($ stores ) {
151+ foreach ($ stores as $ _storeId ) {
152+ if ($ _storeId ) {
153+ $ storeId = $ _storeId ;
154+ break ;
155+ }
156+ }
157+ }
148158 $ current_admin_user = $ this ->getCurrentUser ();
149159 $ admin_user_id = 0 ;
150160 $ email_address = "" ;
@@ -172,7 +182,7 @@ public function aroundExecute(\Magento\Review\Controller\Adminhtml\Product\Save
172182 $ title = htmlspecialchars ($ data ['reply_title ' ]);
173183 $ message = nl2br (htmlspecialchars ($ data ['reply_comment ' ]));
174184
175- $ this ->sendReplyToCustomer ($ sender , $ recipient , $ title , $ message );
185+ $ this ->sendReplyToCustomer ($ sender , $ recipient , $ title , $ message, $ storeId );
176186 }
177187 $ email_address = isset ($ data ['email_address ' ]) ? $ data ['email_address ' ] : '' ;
178188 $ avatar_url = isset ($ data ['avatar_url ' ]) ? $ data ['avatar_url ' ] : '' ;
@@ -240,7 +250,7 @@ public function aroundExecute(\Magento\Review\Controller\Adminhtml\Product\Save
240250 $ modelGallery ->setReviewId ($ reviewId )
241251 ->setLabel ('Gallery of Review ' . $ reviewId )
242252 ->setStatus (\Lof \ProductReviews \Model \Gallery::STATUS_DISABLED )
243- ->setValue (json_encode ([]))
253+ ->setValue (@ json_encode ([]))
244254 ->save ();
245255 }
246256
@@ -252,13 +262,15 @@ public function aroundExecute(\Magento\Review\Controller\Adminhtml\Product\Save
252262 * @param $recipient
253263 * @param $title
254264 * @param $message
265+ * @param int|null $storeId
255266 * @return $this
256267 * @throws \Magento\Framework\Exception\LocalizedException
257268 * @throws \Magento\Framework\Exception\MailException
258269 * @throws \Magento\Framework\Exception\NoSuchEntityException
259270 */
260- public function sendReplyToCustomer ($ sender , $ recipient , $ title , $ message )
271+ public function sendReplyToCustomer ($ sender , $ recipient , $ title , $ message, $ storeId = null )
261272 {
273+ $ storeId = $ storeId ? (int )$ storeId : \Magento \Store \Model \Store::DEFAULT_STORE_ID ;
262274 $ this ->inlineTranslation ->suspend ();
263275
264276 $ dataObj = $ this ->_dataObjectFactory ->create ()->setData (
@@ -273,11 +285,11 @@ public function sendReplyToCustomer($sender, $recipient, $title, $message)
273285 );
274286
275287 $ this ->_transportBuilder ->setTemplateIdentifier (
276- $ this ->_dataHelper ->getReplyEmailTemplate ()
288+ $ this ->_dataHelper ->getReplyEmailTemplate ($ storeId )
277289 )->setTemplateOptions (
278290 [
279291 'area ' => \Magento \Framework \App \Area::AREA_FRONTEND ,
280- 'store ' => $ this -> _storeManager -> getStore ()-> getId () ,
292+ 'store ' => $ storeId ,
281293 ]
282294 )->setFrom (
283295 $ sender
0 commit comments