From 9a47e7717fde7a6396d5a096ef2d472028268c86 Mon Sep 17 00:00:00 2001 From: gonzalo Date: Fri, 21 Apr 2017 16:31:16 -0300 Subject: [PATCH] control if you select a store --- Cron/Ecommerce.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Cron/Ecommerce.php b/Cron/Ecommerce.php index 14033243..6e0b6d84 100644 --- a/Cron/Ecommerce.php +++ b/Cron/Ecommerce.php @@ -86,13 +86,17 @@ public function execute() { $this->_storeManager->setCurrentStore($storeId); if($this->_helper->getConfigValue(\Ebizmarts\MailChimp\Helper\Data::XML_PATH_ACTIVE)) { - $this->_apiResult->processResponses($storeId,true); - $this->_processStore($storeId); + $mailchimpStoreId = $this->_helper->getConfigValue(\Ebizmarts\MailChimp\Helper\Data::XML_MAILCHIMP_STORE,$storeId); + if ($mailchimpStoreId != -1) + { + $this->_apiResult->processResponses($storeId,true, $mailchimpStoreId); + $this->_processStore($storeId, $mailchimpStoreId); + } } } } - protected function _processStore($storeId) + protected function _processStore($storeId, $mailchimpStoreId) { $this->_helper->log(__METHOD__); $batchArray = array(); @@ -121,6 +125,7 @@ protected function _processStore($storeId) $this->_mailChimpSyncBatches->setStoreId($storeId); $this->_mailChimpSyncBatches->setBatchId($batchResponse['id']); $this->_mailChimpSyncBatches->setStatus($batchResponse['status']); + $this->_mailChimpSyncBatches->setMailchimpStoreId($mailchimpStoreId); $this->_mailChimpSyncBatches->getResource()->save($this->_mailChimpSyncBatches); } } catch(Exception $e) {