diff --git a/app/code/community/Ebizmarts/MailChimp/Model/Api/Batches.php b/app/code/community/Ebizmarts/MailChimp/Model/Api/Batches.php index cf8649abc..2d640397e 100644 --- a/app/code/community/Ebizmarts/MailChimp/Model/Api/Batches.php +++ b/app/code/community/Ebizmarts/MailChimp/Model/Api/Batches.php @@ -707,25 +707,30 @@ protected function saveSyncData($itemId, $itemType, $mailchimpStoreId, $syncDelt protected function addSyncValueToArray($storeId, $syncedDateArray) { $helper = $this->getHelper(); - $mailchimpStoreId = $helper->getMCStoreId($storeId); - $syncedDate = $helper->getMCIsSyncing($storeId); - // Check if $syncedDate is in date format to support previous versions. - if (isset($syncedDateArray[$mailchimpStoreId]) && $syncedDateArray[$mailchimpStoreId]) { - if ($helper->validateDate($syncedDate)) { - if ($syncedDate > $syncedDateArray[$mailchimpStoreId]) { - $syncedDateArray[$mailchimpStoreId] = array($storeId => $syncedDate); + $ecomEnabled = $helper->isEcomSyncDataEnabled($storeId); + + if ($ecomEnabled) { + $mailchimpStoreId = $helper->getMCStoreId($storeId); + $syncedDate = $helper->getMCIsSyncing($storeId); + + // Check if $syncedDate is in date format to support previous versions. + if (isset($syncedDateArray[$mailchimpStoreId]) && $syncedDateArray[$mailchimpStoreId]) { + if ($helper->validateDate($syncedDate)) { + if ($syncedDate > $syncedDateArray[$mailchimpStoreId]) { + $syncedDateArray[$mailchimpStoreId] = array($storeId => $syncedDate); + } + } elseif ((int)$syncedDate === 1) { + $syncedDateArray[$mailchimpStoreId] = array($storeId => false); } - } elseif ((int)$syncedDate === 1) { - $syncedDateArray[$mailchimpStoreId] = array($storeId => false); - } - } else { - if ($helper->validateDate($syncedDate)) { - $syncedDateArray[$mailchimpStoreId] = array($storeId => $syncedDate); } else { - if ((int)$syncedDate === 1) { - $syncedDateArray[$mailchimpStoreId] = array($storeId => false); - } elseif (!isset($syncedDateArray[$mailchimpStoreId])) { - $syncedDateArray[$mailchimpStoreId] = array($storeId => true); + if ($helper->validateDate($syncedDate)) { + $syncedDateArray[$mailchimpStoreId] = array($storeId => $syncedDate); + } else { + if ((int)$syncedDate === 1) { + $syncedDateArray[$mailchimpStoreId] = array($storeId => false); + } elseif (!isset($syncedDateArray[$mailchimpStoreId])) { + $syncedDateArray[$mailchimpStoreId] = array($storeId => true); + } } } }