From 770fac329aee91c5214466ab6583fd85e5504a76 Mon Sep 17 00:00:00 2001 From: gonzalo Date: Wed, 26 Jul 2017 14:17:01 -0300 Subject: [PATCH] fix an issue when select inheritance in the config --- Model/Config/Backend/MonkeyList.php | 4 +++- Model/Config/Backend/MonkeyStore.php | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Model/Config/Backend/MonkeyList.php b/Model/Config/Backend/MonkeyList.php index cc3cef9b..c5130881 100644 --- a/Model/Config/Backend/MonkeyList.php +++ b/Model/Config/Backend/MonkeyList.php @@ -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(); } } diff --git a/Model/Config/Backend/MonkeyStore.php b/Model/Config/Backend/MonkeyStore.php index 4c6dae5c..3c6e9fa7 100644 --- a/Model/Config/Backend/MonkeyStore.php +++ b/Model/Config/Backend/MonkeyStore.php @@ -74,6 +74,7 @@ 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']) { @@ -81,7 +82,9 @@ public function beforeSave() } 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; @@ -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); } }