Skip to content

Commit d88a2cb

Browse files
The newest orders are synchronized first.
1 parent 1440c1b commit d88a2cb

File tree

6 files changed

+11
-9
lines changed

6 files changed

+11
-9
lines changed

AbandonedCart/Model/AbandonedCartSendData.php

+6-4
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ public function sendAbandonedCartData($quoteId = null): array
244244
if ($quoteId) {
245245
$abandonedCarts->addFieldToFilter('entity_id', ['eq' => $quoteId]);
246246
}
247-
$abandonedCarts->setPageSize($numberOfAbandonedCart);
247+
$abandonedCarts->setPageSize($numberOfAbandonedCart)->setOrder('main_table.updated_at',"desc");
248248
$abandonedCarts->getSelect()->join(array('address' => $abandonedCarts->getResource()->getTable('quote_address')), 'main_table.entity_id = address.quote_id')
249249
->where("address.address_type='billing' and (main_table.customer_email is not null or address.email is not null)");
250250
foreach ($abandonedCarts as $abandonedCart) {
@@ -288,7 +288,7 @@ public function sendAbandonedCartData($quoteId = null): array
288288
"orderDiscounts" => [
289289
"discountAmount" => $this->coreHelper->priceToCents($abandonedCart->getDiscountAmount())
290290
],
291-
"orderUrl" => $this->urlBuilder->getDirectUrl('checkout/cart'),
291+
"orderUrl" => $this->urlBuilder->setScope($abandonedCart->getStoreId())->getDirectUrl('checkout/cart'),
292292
"abandonedDate" => $this->dateTime->date(strtotime($abandonedUpdateDate),NULL,$timezone)->format('Y-m-d\TH:i:sP'),
293293
"externalCreatedDate" => $this->dateTime->date(strtotime($abandonedCartRepository->getCreatedAt()),NULL,$timezone)->format('Y-m-d\TH:i:sP'),
294294
"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
361361
*/
362362
private function getQuoteItemsData($entityId, $storeId): array
363363
{
364+
364365
$quoteItemsData = [];
366+
$this->appEmulation->startEnvironmentEmulation($storeId, Area::AREA_FRONTEND, true);
365367
$quoteItems = $this->getQuoteItems($entityId);
366368
foreach ($quoteItems as $quoteItem) {
367-
$this->appEmulation->startEnvironmentEmulation($storeId, Area::AREA_FRONTEND, true);
369+
368370

369371
$product = $this->_productRepositoryFactory->create()
370-
->getById($quoteItem->getProductId());
372+
->getById($quoteItem->getProductId(),false,$storeId);
371373

372374
$imageUrl = $this->imageHelperFactory->create()
373375
->init($product, 'product_page_image_medium')->getUrl();

AbandonedCart/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"config": {
1010
"sort-packages": true
1111
},
12-
"version": "2.1.13",
12+
"version": "2.1.14",
1313
"require": {
1414
"php": "~7.3.0||~7.4.0||~8.0||~8.1||~8.2",
1515
"activecampaign/core": "2.1.*"

AbandonedCart/etc/module.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
9-
<module name="ActiveCampaign_AbandonedCart" setup_version="2.1.13">
9+
<module name="ActiveCampaign_AbandonedCart" setup_version="2.1.14">
1010
<sequence>
1111
<module name="Magento_Product"/>
1212
<module name="Magento_Sales"/>

Order/Cron/OrderSyncCron.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function execute(): void
9494
'ac_order_sync_status',
9595
['eq' => 0]
9696
)
97-
->setPageSize($OrderSyncNum);
97+
->setPageSize($OrderSyncNum)->setOrder('main_table.entity_id',"desc");
9898

9999
foreach ($orderCollection as $order) {
100100
try {

Order/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"config": {
1010
"sort-packages": true
1111
},
12-
"version": "2.1.8",
12+
"version": "2.1.9",
1313
"require": {
1414
"php": "~7.3.0||~7.4.0||~8.0||~8.1||~8.2",
1515
"activecampaign/core": "2.1.*"

Order/etc/module.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0"?>
22
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
3-
<module name="ActiveCampaign_Order" setup_version="2.1.8">
3+
<module name="ActiveCampaign_Order" setup_version="2.1.9">
44
<sequence>
55
<module name="ActiveCampaign_Core" />
66
<module name="ActiveCampaign_Customer"/>

0 commit comments

Comments
 (0)