Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't add a new product in a taxon #8130

Closed
aimeric opened this issue Jun 3, 2017 · 16 comments · Fixed by #8268
Closed

Can't add a new product in a taxon #8130

aimeric opened this issue Jun 3, 2017 · 16 comments · Fixed by #8268
Labels
Critical Issues and PRs, which are critical and should be fixed ASAP. Potential Bug Potential bugs or bugfixes, that needs to be reproduced.
Milestone

Comments

@aimeric
Copy link

aimeric commented Jun 3, 2017

Hi,

I have been trying to add a new product in a category , but I can't see the sub categories under category.

On the sylius demo its looks as below:

sylius1

In my back-end its look like this:

sylius2

I'm using sylius 1.0.0-beta.2

@smashou
Copy link

smashou commented Jun 5, 2017

Have you deployed with yarn the admin assets ?

@aimeric
Copy link
Author

aimeric commented Jun 5, 2017

@smashou , Yes I did run yarn , but It didn't work. After running php bin/console sylius:fixtures:load it fixed the issue, but now the thumbnail (sylius_shop_product_thumbnail) of the latest products doesn't show up.

Before to run sylius:fixtures:load all the thumbnail were loaded properly.

The path to the picture seems to be ok.

The thumbnail are not generated in media/cache

config.yml


liip_imagine :
    resolvers :
        default :
            web_path :
                web_root: "%kernel.root_dir%/../web"
                cache_prefix: "media/cache"

    filter_sets :
        cache : ~
        sylius_shop_product_original: ~
        sylius_shop_product_tiny_thumbnail:
            filters:
                thumbnail: { size: [64, 64], mode: outbound }
        sylius_shop_product_small_thumbnail:
            filters:
                thumbnail: { size: [150, 112], mode: outbound }
        sylius_shop_product_thumbnail:
            filters:
                thuimbnail: { size: [260, 260], mode: outbound }
        sylius_shop_product_large_thumbnail:
            filters:
                thumbnail: { size: [550, 412], mode: outbound }

@pcmsystemsltd
Copy link

Same issue here, no taxonomy term tree displayed.

@smashou
Copy link

smashou commented Jun 5, 2017

It seems that the route "sylius_admin_ajax_taxon_leafs" which call findChildren method from TaxonRepository is not working well.

@aimeric
Copy link
Author

aimeric commented Jun 5, 2017

@pcmdev , It seems like not all the fixtures are loaded properly while running php bin/console sylius:fixtures:load

I fixed this issue by adding this line into bin/console.php

ini_set('memory_limit','-1');

Follow the steps below:

  1. composer create-project -s beta sylius/sylius-standard sylius
  2. add this line : ini_set('memory_limit','-1'); into console.php
  3. php bin/console sylius:install
  4. npm install --global yarn
  5. yarn install
  6. yarn add node-sass
  7. yarn run gulp

let me know if it works.

@pcmsystemsltd
Copy link

Are you guys using any custom locale on your shop? I've tried installing a new version and it works OK. On the none working version I'm using en_GB and on the working one en_US. There is a query running to find the leafs where one of the WHERE clauses try to match en_US that I don't have on that version.

@smashou
Copy link

smashou commented Jun 5, 2017

I'm using fr_FR and en_US and still not working. And I have an en_US translation on each of my taxon

@pcmsystemsltd
Copy link

There is a quick way to fix it editing the table "sylius_taxon_translation" and setting the locale to "en_US" in my case, and the tree will be displayed correctly, at least that worked for me. Although I'm not sure how to fix it for new ones.

@smashou
Copy link

smashou commented Jun 5, 2017

For me the quick fix was to override the findChildren and remove the locale from the request. I think it's just a small fix. But I do not have enough time today to fix it. I'll give a try tomorrow :)

@pjedrzejewski pjedrzejewski added the Potential Bug Potential bugs or bugfixes, that needs to be reproduced. label Jun 6, 2017
@pjedrzejewski pjedrzejewski added this to the v1.0.0 milestone Jun 6, 2017
@pcmsystemsltd
Copy link

Just to add an additional comment. When the translation is there the taxonomy tree is rendered, but not completely, it's just displaying the children of top level taxonomies. That happening even on the default Sylius installation.

@gabiudrescu
Copy link
Contributor

isn't this related to #8068?

@pcmsystemsltd
Copy link

pcmsystemsltd commented Jun 8, 2017

I think there are two independent bugs on this ticket:

  • The query not getting the categories if the translation is not set correctly.
  • The rendering of the tree.

The second one is on these files:

https://github.com/Sylius/Sylius/blob/master/src/Sylius/Bundle/AdminBundle/Resources/private/js/sylius-lazy-choice-tree.js

https://github.com/Sylius/Sylius/blob/master/src/Sylius/Bundle/AdminBundle/Resources/private/js/app.js

$('#sylius-product-taxonomy-tree').choiceTree('productTaxon', true, 1);

What's the logic to limit the rendering of the tree with defaultLevel = 1? This way only the root categories and the immediate children are rendered, is this done on purpose for performance? Removing the if check on line 112 of the first file fixes the issue. Or just incrementing the defaultLevel to the appropriate depth.

@pcmsystemsltd
Copy link

pcmsystemsltd commented Jun 8, 2017

@smashou @gabiudrescu there is an easy way to fix the issue related to the categories problem without overriding the getChildren method. The actual "bug" is that the admin user Sylius is creating during the installation has the locale en_US, and therefore it tries to find categories with that locale on the admin. Changing the local of your admin user to en_GB in my case fixed the issue straight away, because the only locale available on my website is en_GB and all my categories are using it.

@pjedrzejewski pjedrzejewski added the Critical Issues and PRs, which are critical and should be fixed ASAP. label Jun 9, 2017
@gabiudrescu
Copy link
Contributor

@pcmdev yup, I confirm. this is the correct way to reproduce the bug(s)!

@bitbager
Copy link
Contributor

bitbager commented Jun 9, 2017

@Arminek, that's exactly the bug I was trying to explain you in Berlin!
//edit: I will try to fix it on weekend.
//edit2: Now fetching taxons will not depend on the admin's locale. This issue also appeared for the findByNamePart repository method used in product taxonomy tab. Now it fetches all taxonomy names in all available locales by the parts which means when you have a Taxon named "shoes" in EN locale and "Schuhe" for the German one, both will be displayed in the AJAX select tab. I think this is the way it should work.

@ccvf2s
Copy link

ccvf2s commented Sep 24, 2018

Good evening,

This is not solved we still have an issue with the JS, https://github.com/Sylius/SyliusAdminBundle/blob/1.3/Resources/private/js/app.js#L86

Why the level is one? Why not rendering all the taxonomies?

Thanks a lot for the help,
Dimitri.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Critical Issues and PRs, which are critical and should be fixed ASAP. Potential Bug Potential bugs or bugfixes, that needs to be reproduced.
Projects
None yet
7 participants