Skip to content

[4.x] Fix sorting of swatches & dropdown#1229

Merged
royduin merged 1 commit into4.xfrom
feature/fix-swatch-sorting
Mar 17, 2026
Merged

[4.x] Fix sorting of swatches & dropdown#1229
royduin merged 1 commit into4.xfrom
feature/fix-swatch-sorting

Conversation

@Jade-GG
Copy link
Collaborator

@Jade-GG Jade-GG commented Mar 13, 2026

ref: GT-2514

This already works properly in 5.x because we sort on the attribute accessor. We can't do that here, it doesn't work if you sort in the query because json_objectagg has no defined order.

As such, we have to sort like this for just this once.

@Jade-GG Jade-GG marked this pull request as ready for review March 13, 2026 10:55
@royduin
Copy link
Member

royduin commented Mar 13, 2026

Maybe cleaner to have a custom cast for this: https://laravel.com/docs/master/eloquent-mutators#custom-casts and assign that in the CastSuperAttributes.php. Not sure if that's worth it for 4.x as we're already taken care of it in 5.x? Thoughts @indykoning?

@Jade-GG
Copy link
Collaborator Author

Jade-GG commented Mar 13, 2026

Maybe cleaner to have a custom cast for this: https://laravel.com/docs/master/eloquent-mutators#custom-casts and assign that in the CastSuperAttributes.php. Not sure if that's worth it for 4.x as we're already taken care of it in 5.x? Thoughts @indykoning?

Yeah I figured it's overkill to over-engineer something in an older version.

@royduin royduin merged commit cc0464e into 4.x Mar 17, 2026
21 of 24 checks passed
@royduin royduin deleted the feature/fix-swatch-sorting branch March 17, 2026 12:19
@royduin
Copy link
Member

royduin commented Mar 17, 2026

Merged, but still waiting for an approval by @indykoning

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

Successfully merging this pull request may close these issues.

2 participants