Skip to content

Commit

Permalink
closes #1640 for magento 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzaloebiz committed Dec 27, 2022
1 parent 0595c42 commit b37d89c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 42 deletions.
20 changes: 1 addition & 19 deletions Controller/Adminhtml/Ecommerce/ResyncProducts.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,25 +57,7 @@ public function execute()
$valid = 1;
$message = '';
$params = $this->getRequest()->getParams();
if (isset($params['website'])) {
$mailchimpStore = $this->helper->getConfigValue(
\Ebizmarts\MailChimp\Helper\Data::XML_MAILCHIMP_STORE,
$params['website'],
'website'
);
} elseif (isset($params['store'])) {
$mailchimpStore = $this->helper->getConfigValue(
\Ebizmarts\MailChimp\Helper\Data::XML_MAILCHIMP_STORE,
$params['store'],
'store'
);
} else {
$mailchimpStore = $this->helper->getConfigValue(
\Ebizmarts\MailChimp\Helper\Data::XML_MAILCHIMP_STORE,
$this->storeManager->getStore()
);
}

$mailchimpStore = $params['mailchimpStoreId'];
$resultJson = $this->resultJsonFactory->create();
try {
$this->helper->resyncProducts($mailchimpStore);
Expand Down
20 changes: 1 addition & 19 deletions Controller/Adminhtml/Ecommerce/ResyncSubscribers.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,25 +57,7 @@ public function execute()
$valid = 1;
$message = '';
$params = $this->getRequest()->getParams();
if (isset($params['website'])) {
$mailchimpList = $this->helper->getConfigValue(
\Ebizmarts\MailChimp\Helper\Data::XML_PATH_LIST,
$params['website'],
'website'
);
} elseif (isset($params['store'])) {
$mailchimpList = $this->helper->getConfigValue(
\Ebizmarts\MailChimp\Helper\Data::XML_PATH_LIST,
$params['store'],
'store'
);
} else {
$mailchimpList = $this->helper->getConfigValue(
\Ebizmarts\MailChimp\Helper\Data::XML_PATH_LIST,
$this->storeManager->getStore()
);
}

$mailchimpList = $params['listId'];
$resultJson = $this->resultJsonFactory->create();
try {
$this->helper->resyncAllSubscribers($mailchimpList);
Expand Down
8 changes: 4 additions & 4 deletions view/adminhtml/web/js/configapikey.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ define(
self._createWebhook(apiKey, listId);
});
$('#mailchimp_general_resync_subscribers').click(function () {
var mailchimpStoreId = $('#mailchimp_general_monkeystore').find(':selected').val();
self._resyncSubscribers(mailchimpStoreId);
var listId = $('#mailchimp_general_monkeylist').find(':selected').val();
self._resyncSubscribers(listId);
});
$('#mailchimp_ecommerce_resync_products').click(function () {
var mailchimpStoreId = $('#mailchimp_general_monkeystore').find(':selected').val();
Expand Down Expand Up @@ -236,11 +236,11 @@ define(
}
});
},
_resyncSubscribers: function (mailchimpStoreId) {
_resyncSubscribers: function (listId) {
var resyncSubscribersUrl = this.options.resyncSubscribersUrl;
$.ajax({
url: resyncSubscribersUrl,
data: {'form_key': window.FORM_KEY, 'mailchimpStoreId': mailchimpStoreId},
data: {'form_key': window.FORM_KEY, 'listId': listId},
type: 'GET',
dataType: 'json',
showLoader: true
Expand Down

0 comments on commit b37d89c

Please sign in to comment.