diff --git a/view/adminhtml/templates/system/config/fieldset/hint.phtml b/view/adminhtml/templates/system/config/fieldset/hint.phtml
index 917f151b..c002a9f5 100644
--- a/view/adminhtml/templates/system/config/fieldset/hint.phtml
+++ b/view/adminhtml/templates/system/config/fieldset/hint.phtml
@@ -16,7 +16,8 @@
"storeGridUrl": "getUrl('mailchimp/stores/index');?>",
"createWebhookUrl": "getUrl('mailchimp/ecommerce/createWebhook');?>",
"getInterestUrl": "getUrl('mailchimp/ecommerce/getInterest');?>",
- "resyncSubscribersUrl": "getUrl('mailchimp/ecommerce/resyncSubscribers');?>"}}'>
+ "resyncSubscribersUrl": "getUrl('mailchimp/ecommerce/resyncSubscribers');?>",
+ "resyncProductsUrl": "getUrl('mailchimp/ecommerce/resyncProducts');?>"}}'>
diff --git a/view/adminhtml/templates/system/config/resyncproducts.phtml b/view/adminhtml/templates/system/config/resyncproducts.phtml
new file mode 100644
index 00000000..e2e5c3c1
--- /dev/null
+++ b/view/adminhtml/templates/system/config/resyncproducts.phtml
@@ -0,0 +1,6 @@
+
+
+
+
diff --git a/view/adminhtml/web/js/configapikey.js b/view/adminhtml/web/js/configapikey.js
index 6caa5316..0ff0c9da 100644
--- a/view/adminhtml/web/js/configapikey.js
+++ b/view/adminhtml/web/js/configapikey.js
@@ -22,7 +22,8 @@ define(
"storeGridUrl": "",
"createWebhookUrl": "",
"getInterestUrl": "",
- "resyncSubscribersUrl": ""
+ "resyncSubscribersUrl": "",
+ "resyncProductsUrl": ""
},
_init: function () {
@@ -48,6 +49,10 @@ define(
var mailchimpStoreId = $('#mailchimp_general_monkeystore').find(':selected').val();
self._resyncSubscribers(mailchimpStoreId);
});
+ $('#mailchimp_ecommerce_resync_products').click(function () {
+ var mailchimpStoreId = $('#mailchimp_general_monkeystore').find(':selected').val();
+ self._resyncProducts(mailchimpStoreId);
+ });
},
_resyncSubscribers: function (mailchimpStoreId) {
@@ -66,6 +71,22 @@ define(
}
});
},
+ _resyncProducts: function (mailchimpStoreId) {
+ var resyncProductsUrl = this.options.resyncProductsUrl;
+ $.ajax({
+ url: resyncProductsUrl,
+ data: {'form_key': window.FORM_KEY, 'mailchimpStoreId': mailchimpStoreId},
+ type: 'GET',
+ dataType: 'json',
+ showLoader: true
+ }).done(function (data) {
+ if (data.valid == 0) {
+ alert({content: 'Error: can\'t resync your products'});
+ } else if (data.valid == 1) {
+ alert({content: 'All products marked for resync'});
+ }
+ });
+ },
_createWebhook: function (apiKey, listId) {
var createWebhookUrl = this.options.createWebhookUrl;
$.ajax({