Skip to content

Commit

Permalink
control if you select a store
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzaloebiz committed Apr 21, 2017
1 parent 6af85a6 commit 9a47e77
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Cron/Ecommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 9a47e77

Please sign in to comment.