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
Product variant option value not selected in admin #8999
Comments
Related to #8744 |
I can confirm this still exists on a v1.2.x installation. I unfortunately have no clue why it occurs though. It seems the same as issue as #8144. Weird thing is that client created product on staging and had the options available, now did it at production and no options shown (setups + code are identical). I will try to figure out what they've done differently this time (e.g. order of adding things). |
Product options are created in the same order both on staging & production in my case. It's hard to see whether the option values have been created at the same time or later. The variants in both cases are generated automated, which basically takes the output of the
Client claims this has been used both on staging as on production, which makes me believe the order is similar. |
Ah, it seems to be easier in my case; there is no option selected (and therefore the placeholder is active) due to option values being deactivated. So the variant can still exist, option value is disabled, it won't be used in the form anymore and as soon as you want to save that variant for whatever reason it will fail. Not sure that's intended of course. |
Problem
In the Sylius admin, when editting a product variant with two options: Color and Size a situation can occur when the correct option value (eg: red or XL) is not loaded in the
<select>
and the default value is selected instead.It turns out to be caused by the order in which the option values are saved. This is visible in \Symfony\Component\Form\ChoiceList\ArrayChoiceList::getValuesForChoices where $this->options is a list of colors, but the $choices array contains a size.
Expected situation
The correct option value is selected regardless of the order the options are saved in the database.
Solution
As for a solution I can think of three possibilities:
I have not managed to find a solution. Maybe I can create a patch if someone can confirm the situation/point in a direction.
Additional data
Working situation:
Bug situation:
Maybe related to:
#8144
The text was updated successfully, but these errors were encountered: