понедельник, 4 сентября 2017 г.

sylius "No locale has been set and current locale is undefined" error after generating slug for taxon

Replace in \Sylius\Bundle\AdminBundle\Resources\private\js\sylius-taxon-slug.js in function below

function updateSlug(element) {
    var slugInput = element.parents('.content').find('[name*="[slug]"]');
    var loadableParent = slugInput.parents('.field.loadable');

    if ('readonly' == slugInput.attr('readonly')) {
        return;
    }

    loadableParent.addClass('loading');

    var data;
    if ('' != slugInput.attr('data-parent') && undefined != slugInput.attr('data-parent')) {
        data = { name: element.val(), parentId: slugInput.attr('data-parent') };
    } else if ($('#sylius_taxon_parent').length > 0 && $('#sylius_taxon_parent').is(':visible') && '' != $('#sylius_taxon_parent').val()) {
        data = { name: element.val(), parentId: $('#sylius_taxon_parent').val() };
    } else {
        data = { name: element.val() };
    }


last else's data to:


data = { name: element.val(), locale: element.closest('[data-locale]').data('locale') };

And after that ajax will work.

Комментариев нет:

Отправить комментарий