This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 3 replies, has 2 voices.

Last updated by Bruno Kos 3 months, 2 weeks ago.

Assigned support staff: Bruno Kos.

Author Posts
July 6, 2019 at 12:45 pm #4155859

severinP

If you have many products in your shop and you go to /wp-admin/admin.php?page=sitepress-multilingual-cms%2Fmenu%2Ftaxonomy-translation.php

Select a product taxonomy attribute and then at the bottom of the page, click on the button "Synchronize attributes and update product variations"

The request will timeout (depending on the host settings, usually after 1minute)

This is due to a bug in the code in woocommerce-multilingual/inc/class-wcml-terms.php > public function wcml_sync_product_variations

if($variations_processed >= $variations_treshold){
    break; //This should be break 2; (because there is 2 foreach)
}

//...
echo json_encode($response); //This should be wp_send_json($response); (else the correct headers are not sent)
exit;

I also suspect there are issues in the file woocommerce-multilingual/res/js/taxonomy_translation.js that makes the ajax call, the form cannot be resubmitted

The fix would be the following


    $(document).on('submit', '#wcml_tt_sync_variations', function () {

        var this_form = $('#wcml_tt_sync_variations');
        var data = this_form.serialize();
        this_form.find('.wcml_tt_spinner').fadeIn();
        this_form.find('input[type=submit]').attr('disabled', 'disabled');

        recursive_sync(data);

        return false;

    });
    function updateURLParameter(additionalURL, param, paramVal){
        var newAdditionalURL = "";
        var temp = "";
        var tempArray;
        if (additionalURL) {
            tempArray = additionalURL.split("&");
            for (var i=0; i<tempArray.length; i++){
                if(tempArray[i].split('=')[0] != param){
                    newAdditionalURL += temp + tempArray[i];
                    temp = "&";
                }
            }
        }

        var rows_txt = temp + "" + param + "=" + paramVal;
        return newAdditionalURL + rows_txt;
    }

    function recursive_sync(data) {
        $.post(ajaxurl, data, function (response) {
            var this_form = $('#wcml_tt_sync_variations');
            this_form.find('.wcml_tt_sycn_preview').html(response.progress);
            if (response.go) {
                data = updateURLParameter(data, 'last_post_id', response.last_post_id);
                data = updateURLParameter(data, 'languages_processed', response.languages_processed);
                recursive_sync(data);
            } else {
                this_form.find('input[name=last_post_id]').val(0);
                this_form.find('.wcml_tt_spinner').fadeOut();
                this_form.find('input').removeAttr('disabled');
                jQuery('#wcml_tt_sync_assignment').fadeOut();
                jQuery('#wcml_tt_sync_desc').fadeOut();
            }

        });
    }
July 8, 2019 at 9:45 am #4160593

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

Thank you for contacting WPML support!

I sent these comments of yours to our 2nd tier support so that I could get their opinions - I will get back to you shortly, as soon as they reply back to me.

Regards,
Bruno Kos

July 8, 2019 at 11:51 am #4162121

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

Can you tell me if you would be able to provide us the following:
- Duplicator package with a large number of products that need to be synchronized, where we can expect the issue to happen
- server settings information that would allow us to reproduce the issues on our end

Related to the server settings, I had a handful of clients who weren't able to synchronize product variations due to large amount of items, but on my localhost I think that changing the max_execution_time was usually enough for the synchronization to be completed, even though these values would need to be quite large.

Regards,
Bruno Kos

July 8, 2019 at 11:52 am #4162123

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

I have marked your next reply as private where he can provide us with Duplicator package and WordPress credentials (in case you can provide both).

Regards,
Bruno Kos

The topic ‘[Closed] WCML Taxonomy synchronization doesn't work / times out’ is closed to new replies.