Skip to content

Commit

Permalink
fix an issue when select inheritance in the config
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzaloebiz committed Jul 26, 2017
1 parent bff9e23 commit 770fac3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion Model/Config/Backend/MonkeyList.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ public function afterSave()
$data = $this->getData('groups');
$oldListId = $this->getOldValue();
$this->_registry->register('oldListId', $oldListId);
$this->_registry->register('apiKey', $data['general']['fields']['apikey']['value']);
if(isset($data['general']['fields']['apikey'])) {
$this->_registry->register('apiKey', $data['general']['fields']['apikey']['value']);
}
return parent::afterSave();
}
}
7 changes: 5 additions & 2 deletions Model/Config/Backend/MonkeyStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,17 @@ public function beforeSave()
{
$data = $this->getData('groups');
$found = 0;
$newListId = null;
if (isset($data['ecommerce']['fields']['active']['value'])) {
$active = $data['ecommerce']['fields']['active']['value'];
} elseif ($data['ecommerce']['fields']['active']['inherit']) {
$active = $data['ecommerce']['fields']['active']['inherit'];
}
if ($active && $this->isValueChanged()) {
$mailchimpStore = $this->getOldValue();
$newListId = $data['general']['fields']['monkeylist']['value'];
if(isset($data['general']['fields']['monkeylist'])) {
$newListId = $data['general']['fields']['monkeylist']['value'];
}
$this->oldListId = $this->_helper->getConfigValue(\Ebizmarts\MailChimp\Helper\Data::XML_PATH_LIST, $this->getScopeId());

$createWebhook = true;
Expand All @@ -100,7 +103,7 @@ public function beforeSave()
$this->_helper->markAllBatchesAs($mailchimpStore, 'canceled');
$this->_helper->resetErrors($mailchimpStore);
}
if ($createWebhook) {
if ($createWebhook&&isset($data['general']['fields']['apikey'])) {
$this->_helper->createWebHook($data['general']['fields']['apikey']['value'], $newListId);
}
}
Expand Down

0 comments on commit 770fac3

Please sign in to comment.