first commit
This commit is contained in:
34
modules/mailchimppro/views/js/sync/index.php
Normal file
34
modules/mailchimppro/views/js/sync/index.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2018 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2018 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../');
|
||||
exit;
|
||||
47
modules/mailchimppro/views/js/sync/product.js
Normal file
47
modules/mailchimppro/views/js/sync/product.js
Normal file
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* PrestaChamps
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Commercial License
|
||||
* you can't distribute, modify or sell this code
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file
|
||||
* If you need help please contact leo@prestachamps.com
|
||||
*
|
||||
* @author Mailchimp
|
||||
* @copyright PrestaChamps
|
||||
* @license commercial
|
||||
*/
|
||||
$(document).ready(function () {
|
||||
$("#product-sync .submit").click(function () {
|
||||
$("#product-sync").addClass("sync-is-running");
|
||||
$("#product-sync .progress").removeClass("hidden");
|
||||
$("#product-sync .progress .progress-bar").css("width", "0%");
|
||||
var productBatch = productIds.chunk(itemsPerRequest);
|
||||
for (var i = 0; i < productBatch.length; i++) {
|
||||
let current = i;
|
||||
$.ajaxq("productSync", {
|
||||
url: syncUrl,
|
||||
type: 'POST',
|
||||
data: {
|
||||
action: 'productSync',
|
||||
method: $('#product-sync input[name=method]:checked').val(),
|
||||
syncMode: $('#product-sync input[name=syncMode]:checked').val(),
|
||||
items: productBatch[i]
|
||||
},
|
||||
}).success(function (response) {
|
||||
$("#product-sync #result").html(JSON.stringify(response, null, 2));
|
||||
toastr.success(parseInt(current + 1) * parseInt(itemsPerRequest) + " / " + productIds.length + " completed");
|
||||
}).fail(function (xhr, status, error) {
|
||||
console.log(xhr);
|
||||
toastr.error("Error while launching product sync batch");
|
||||
}).done(function () {
|
||||
$("#product-sync .progress .progress-bar").css("width", (((current + 1) * parseInt(itemsPerRequest) * 100) / productIds.length) + "%");
|
||||
});
|
||||
}
|
||||
$("#product-sync").removeClass("sync-is-running");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user