Skip to content

Commit

Permalink
add control if you enter an apikey first
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzaloebiz committed Apr 24, 2017
1 parent 9a47e77 commit 6725f79
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,9 @@ public function loadStores()
$apiKeys = $this->getConfigValue(self::XML_PATH_APIKEY_LIST);
$keys = explode("\n", $apiKeys);
foreach($keys as $apiKey) {
if(!$apiKey || $apiKey =='') {
continue;
}
$this->_api->setApiKey(trim($apiKey));
$this->_api->setUserAgent('Mailchimp4Magento' . (string)$this->getModuleVersion());
$apiStores = $this->_api->ecommerce->stores->get(null,null,null,self::MAXSTORES);
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
"description": "Connect MailChimp with Magento",
"type": "magento2-module",
"version": "1.0.5",
"version": "1.0.6",
"authors": [
{
"name": "Ebizmarts Corp",
Expand Down
4 changes: 2 additions & 2 deletions etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<label>Enabled</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="apikeylist" translate="label" type="textarea" sortOrder="20" showInDefault="1">
<field id="apikeylist" translate="label" type="textarea" sortOrder="15" showInDefault="1">
<label>API Key list</label>
<backend_model>Ebizmarts\MailChimp\Model\Config\Backend\ApiKey</backend_model>
<comment>Enterlist of API keys one per line</comment>
Expand All @@ -54,7 +54,7 @@
<field id="*/*/active">1</field>
</depends>
</field>
<field id="monkeystore" translate="label" type="select" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="monkeystore" translate="label" type="select" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Mailchimp Store</label>
<source_model>Ebizmarts\MailChimp\Model\Config\Source\MonkeyStore</source_model>
<backend_model>Ebizmarts\MailChimp\Model\Config\Backend\MonkeyStore</backend_model>
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Ebizmarts_MailChimp" setup_version="1.0.5">
<module name="Ebizmarts_MailChimp" setup_version="1.0.6">
<sequence>
<module name="Magento_Newsletter"/>
</sequence>
Expand Down

0 comments on commit 6725f79

Please sign in to comment.