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

Global attribute terms on new product are not aware of product language #16

Closed
Jon007 opened this issue Jul 4, 2016 · 5 comments
Closed
Assignees
Milestone

Comments

@Jon007
Copy link

Jon007 commented Jul 4, 2016

very minor bug - when you first add a global attribute to a product, all the attribute's terms in all languages are available for selection.
When you go back in after saving the product, the global attribute correctly displays only the choices for the product language.

@decarvalhoaa
Copy link
Owner

Let me run this back to you, to ensure I got it.

You are adding a global attribute (e.g. Color) to a product named "Awesome Shoes". "Awesome Shoes" language is EN. You then select all possible values (e.g. Black, Brown, White, Preto, Castanho, Branco), including the values Preto, Castanho, Branco for the language PT, that is different from the language EN of "Awesome Shoes" you are currently editing. Is this the use case?

@Jon007
Copy link
Author

Jon007 commented Jul 4, 2016

Yes that's exactly it.
It only happens on first creating the product, when it is possible to select colours in all the different languages - and save. Impact is minor but may cause a little confusion, especially if your colours or other terms have the same spelling in some of the languages.

When viewing a product thus created:

  • Production Additional Information, Colour lists all the colours in the correct product language
  • if variations were created only the correct language variation is shown.

When translating a product thus created, the correct variations are created in the correct language.

When re-editing a product thus created:

  • the attributes tab shows the colours in the correct language
  • the variations tab shows the variations which were created in other language as eg:
    #1870 Any Colour
    #1869 Any Colour
    These can be easily fixed by clicking on "Any Colour" and re-selecting from the list of terms which is displayed correctly.

@decarvalhoaa
Copy link
Owner

This is a tricky one. When you first create a product, the language of the product is not known to Poylang, and this is why Polylng is not filtering the terms by language as it does when the product has been published/saved.

True that Variable products can only be created in the default language (Plugin limitation I need to figure it out how to beat) and the Polylang language dropdown has the default language selected.

But the issues I see are (assuming I find a filter to remove the terms that don't belong):

  1. other products than variable can have attributes two and can be created in any language first.
  2. we could use PLL()->pref_lang (the default language assigned to a new post is stored here and it can be filtered with 'pll_admin_preferred_language') and remove the terms that don't belong. But if the user goes and changes the Polylang Dropdown to a different language, these terms would need to be replace by the translations.

This is a small nightmare to fix. I need to think a bit about it. Maybe replacing the woocommerce ajax that adds the terms by a custom one that takes the dropdown option selected, and some backend logic to filter by that language. Tricky....

@Jon007
Copy link
Author

Jon007 commented Jul 4, 2016

  • Non variable products attributes are ok - whichever language the terms are selected in, it still works and ends up linking to the right language term, as far as I have seen: I mean you select 'negro' and 'white' and you will get 'black' and 'white' when you save.
  • Variable products, I would suggest leave as a known issue/faq item, that product should be saved first before creating variations. This is a good idea anyway, and applies to other attributes, for example to add product size/weight automatically to variations, you have to save the product first.

Don't have nightmares about it, this is not a blocker in any way.

@decarvalhoaa
Copy link
Owner

Credit to @TeemuSuoranta

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants