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

Variations not (really) sortable #751

Open
innomedia opened this issue Jul 23, 2020 · 1 comment
Open

Variations not (really) sortable #751

innomedia opened this issue Jul 23, 2020 · 1 comment

Comments

@innomedia
Copy link

Product variations are sortable in the backend. But when building the dropdown in the frontend form, sort order is ignored. It's simply missing in the query in the ProductVariationsExtension

@MLindenhofer
Copy link
Contributor

MLindenhofer commented Oct 18, 2023

That's because the dropdown itself, does not list the Variations but the AttributeTypes and the corresponding values.

Look here:

$attributes = $product->VariationAttributeTypes();
foreach ($attributes as $attribute) {
$attributeDropdown = $attribute->getDropDownField(
_t(
__CLASS__ . '.ChooseAttribute',
'Choose {attribute} …',
'',
['attribute' => $attribute->Label]
),
$product->possibleValuesForAttributeType($attribute)->sort(['Sort' => 'ASC'])
);

So it just does not care about the sort order of the Variations.

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

No branches or pull requests

2 participants