Woozone (Products synchronization) Price Update Solution

This is my solution for Woozone Products synchronization problem fix

The code will click on “Sync Now” Button for each product in the List
You can delete already updated products (for this month for example August)

Woozone price update does not work anymore for me, so I have made this code to automatically update over 2000 products.

Last Update 27.01.2018

IMPORTANT : must  , so the page does not refresh.

Now the code checks for errors and goes to the next pages.

Now it also updates the variations !

Please choose 5 products per page.

Instructions (javascript code)

1. Open the link in Chrome : https://…./wp-admin/admin.php?page=WooZone_synclog
2. Select 500 product per page (MAX , more will break the website)
3. Press F12
4. Put the code in the console and press enter

var seconds = 10;
var products = document.getElementsByClassName("WooZone-sync-table-row ");
var nextPage = document.getElementsByClassName("next-page WooZone-jump-page");

function startUpdate(i) {
setTimeout(function() {
update(i)
}, 1000 * seconds);
}

function update(i) {
if (products[i]) {
button = products[i].getElementsByTagName("button");
button[0].click();
console.log(i + 1 + " updated");
}
i++;
if (i <= products.length) {
startUpdate(i);
} else {
checkNotUpdatedProducts();
}
}

function goToNextPage() {
console.log("Products updated ! Going to the next page.");
currentPage = document.getElementsByClassName("current-page");
totalPages = document.getElementsByClassName("total-pages");
if (currentPage[0].value < parseInt(totalPages[0].innerText)) {
nextPage[0].click();
setTimeout(function() {
openMinusVariations();
openPlusVariations();
products = document.getElementsByClassName("WooZone-sync-table-row ");
console.log("Starting to update products on page : " + currentPage[0].value);
startUpdate(0);
}, 10000);
}
}

function checkNotUpdatedProducts() {
errorsIndex = [];
checkProducts = document.getElementsByClassName("WooZone-row-loading-marker");
for (i = 0; i < checkProducts.length; i++) { if (checkProducts[i].style.display != 'none') { errorsIndex.push(document.getElementsByClassName("WooZone-sync-table-row ")[i]); } } products = errorsIndex; if (products.length > 0) {
console.log("Some products are not updated, fixing this now.");
startUpdate(0);
} else {
goToNextPage();
}
}

function openMinusVariations() {
var minusVariations = document.getElementsByClassName("wz-show-variations sign-minus");
Array.from(minusVariations).forEach(function(element) {
setTimeout(function() {
element.click()
}, 1000);
});
setTimeout(function() {
products = document.getElementsByClassName("WooZone-sync-table-row ");
}, 8000);
}

function openPlusVariations() {
var plusVariations = document.getElementsByClassName("wz-show-variations sign-plus");
Array.from(plusVariations).forEach(function(element) {
setTimeout(function() {
element.click()
}, 1000);
});
setTimeout(function() {
products = document.getElementsByClassName("WooZone-sync-table-row ");
}, 8000);
}
openMinusVariations();
openPlusVariations();
startUpdate(0);

UPDATE 27-01-2018

If you get any error updating prices with variations this is because the server is overloaded.
You can try to update prices without variations, this works faster :

var seconds = 10;
var products = document.getElementsByClassName("WooZone-sync-table-row ");
var nextPage = document.getElementsByClassName("next-page WooZone-jump-page");

function startUpdate(i) {
setTimeout(function() {
update(i)
}, 1000 * seconds);
}

function update(i) {
if (products[i]) {
button = products[i].getElementsByTagName("button");
button[0].click();
console.log(i + 1 + " updated");
}
i++;
if (i <= products.length) {
startUpdate(i);
} else {
checkNotUpdatedProducts();
}
}

function goToNextPage() {
console.log("Products updated ! Going to the next page.");
currentPage = document.getElementsByClassName("current-page");
totalPages = document.getElementsByClassName("total-pages");
if (currentPage[0].value < parseInt(totalPages[0].innerText)) {
nextPage[0].click();
setTimeout(function() {
products = document.getElementsByClassName("WooZone-sync-table-row ");
console.log("Starting to update products on page : " + currentPage[0].value);
startUpdate(0);
}, 10000);
}
}

function checkNotUpdatedProducts() {
errorsIndex = [];
checkProducts = document.getElementsByClassName("WooZone-row-loading-marker");
for (i = 0; i < checkProducts.length; i++) { if (checkProducts[i].style.display != 'none') { errorsIndex.push(document.getElementsByClassName("WooZone-sync-table-row ")[i]); } } products = errorsIndex; if (products.length > 0) {
console.log("Some products are not updated, fixing this now.");
startUpdate(0);
} else {
goToNextPage();
}
}

startUpdate(0);

“I’ve updated WooZone and I’m having problems with the Synchronization module”
The basic functionalty of WooZone is to let you import products from Amazon into your WordPress + WooCommerce website.
But if the synchronization module for the price update is not working , you will have issues with Amazon putting at risk your account, because you are showing wrong product prices on your affiliated website.

Update : Another solution is to run WordPress and WooZone from localhost