четверг, 28 сентября 2017 г.

Sylius - The table with name 'sylius_order' already exists

1) be sure you have added your class' model parameter to config.yml, as described in Sylius documentation;

2) be sure you do not use old parent class somewhere else in config.yml - for example, this will cause error below. Do not forget to change it as new class:
sylius_resource:
    resources:
        sylius.accountant:
            classes:
                model: AppBundle\Entity\Order
        sylius.worker:
            classes:
                model: AppBundle\Entity\Order


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

Sylius Grid component - updatedAt field not found

You should to add needed field in Grid fields and make it sortable. For example, it should look like this:
sylius_grid:    grids:        sylius_admin_product:            fields:                updatedAt:                    type: datetime
                    label: sylius.ui.last_updated
                    options:                        format: d.m.Y H:i
                    sortable: ~

[sylius] cannot delete product, product in use

1. you should delete all orders, where contains product needs to delete.
2. remove all carts where, where remains this product. You can do it with php bin/console sylius:remove-expired-carts . If you need to remove all carts for all days, add parameter sylius_order.cart_expiration_period: to app/config/config.yml and rerun previous command again.

понедельник, 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.