Skip to content

Commit

Permalink
add the time zone #2041 for magento 2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzaloebiz committed Nov 28, 2024
1 parent ad2b522 commit a77a2e2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Cron/GenerateStatistics.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Ebizmarts\MailChimp\Cron;

use Magento\Framework\Component\ComponentRegistrar;
use Magento\Store\Model\StoreManager;
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
use Magento\Customer\Model\ResourceModel\Customer\CollectionFactory as CustomerCollectionFactory;
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory as ProductCollectionFactory;
use Magento\Sales\Model\ResourceModel\Order\CollectionFactory as OrderCollectionFactory;
Expand Down Expand Up @@ -56,6 +56,7 @@ class GenerateStatistics
* @var ModuleVersion
*/
protected $moduleVersion;
protected $locale;
protected $deleteAction = [
0 => 'Unsubscribe',
1 => 'Delete',
Expand All @@ -70,7 +71,8 @@ public function __construct(
MailchimpSyncBatchesCollectionFactory $mailchimpSyncBatchesCollectionFactory,
ScheduleCollectionFactory $scheduleCollectionFactory,
ProductMetadataInterface $productMetadata,
ModuleVersion $moduleVersion
ModuleVersion $moduleVersion,
TimezoneInterface $locale
)
{
$this->mailchimpNotificationFactory = $mailchimpNotificationFactory;
Expand All @@ -83,6 +85,7 @@ public function __construct(
$this->scheduleCollectionFactory = $scheduleCollectionFactory;
$this->productMetadata = $productMetadata;
$this->moduleVersion = $moduleVersion;
$this->locale = $locale;
}
public function execute()
{
Expand Down Expand Up @@ -173,7 +176,7 @@ private function getMagentoTotals($storeId)
} catch (\Exception $e) {
$this->helper->log($e->getMessage());
}

$options['time_zone'] = $this->locale->getConfigTimezone(\Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId);
return $options;
}
private function getMailchimpTotals($storeId)
Expand Down

0 comments on commit a77a2e2

Please sign in to comment.