@@ -244,7 +244,7 @@ public function sendAbandonedCartData($quoteId = null): array
244
244
if ($ quoteId ) {
245
245
$ abandonedCarts ->addFieldToFilter ('entity_id ' , ['eq ' => $ quoteId ]);
246
246
}
247
- $ abandonedCarts ->setPageSize ($ numberOfAbandonedCart );
247
+ $ abandonedCarts ->setPageSize ($ numberOfAbandonedCart )-> setOrder ( ' main_table.updated_at ' , " desc " ) ;
248
248
$ abandonedCarts ->getSelect ()->join (array ('address ' => $ abandonedCarts ->getResource ()->getTable ('quote_address ' )), 'main_table.entity_id = address.quote_id ' )
249
249
->where ("address.address_type='billing' and (main_table.customer_email is not null or address.email is not null) " );
250
250
foreach ($ abandonedCarts as $ abandonedCart ) {
@@ -288,7 +288,7 @@ public function sendAbandonedCartData($quoteId = null): array
288
288
"orderDiscounts " => [
289
289
"discountAmount " => $ this ->coreHelper ->priceToCents ($ abandonedCart ->getDiscountAmount ())
290
290
],
291
- "orderUrl " => $ this ->urlBuilder ->getDirectUrl ('checkout/cart ' ),
291
+ "orderUrl " => $ this ->urlBuilder ->setScope ( $ abandonedCart -> getStoreId ())-> getDirectUrl ('checkout/cart ' ),
292
292
"abandonedDate " => $ this ->dateTime ->date (strtotime ($ abandonedUpdateDate ),NULL ,$ timezone )->format ('Y-m-d\TH:i:sP ' ),
293
293
"externalCreatedDate " => $ this ->dateTime ->date (strtotime ($ abandonedCartRepository ->getCreatedAt ()),NULL ,$ timezone )->format ('Y-m-d\TH:i:sP ' ),
294
294
"externalUpdatedDate " => $ this ->dateTime ->date (strtotime ($ abandonedUpdateDate ),NULL ,$ timezone )->format ('Y-m-d\TH:i:sP ' ),
@@ -361,13 +361,15 @@ public function sendAbandonedCartData($quoteId = null): array
361
361
*/
362
362
private function getQuoteItemsData ($ entityId , $ storeId ): array
363
363
{
364
+
364
365
$ quoteItemsData = [];
366
+ $ this ->appEmulation ->startEnvironmentEmulation ($ storeId , Area::AREA_FRONTEND , true );
365
367
$ quoteItems = $ this ->getQuoteItems ($ entityId );
366
368
foreach ($ quoteItems as $ quoteItem ) {
367
- $ this -> appEmulation -> startEnvironmentEmulation ( $ storeId , Area:: AREA_FRONTEND , true );
369
+
368
370
369
371
$ product = $ this ->_productRepositoryFactory ->create ()
370
- ->getById ($ quoteItem ->getProductId ());
372
+ ->getById ($ quoteItem ->getProductId (), false , $ storeId );
371
373
372
374
$ imageUrl = $ this ->imageHelperFactory ->create ()
373
375
->init ($ product , 'product_page_image_medium ' )->getUrl ();
0 commit comments