Skip to content

[5.x] Only get store-specific values for options#1220

Merged
royduin merged 12 commits intomasterfrom
feature/store-specific-options
Mar 24, 2026
Merged

[5.x] Only get store-specific values for options#1220
royduin merged 12 commits intomasterfrom
feature/store-specific-options

Conversation

@Jade-GG
Copy link
Copy Markdown
Collaborator

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

ref: RAP-1828

This is a pretty dumb hack.

I initially added a GROUP BY on the store_id, which splits the resulting rows nicely in SQL. However, I noticed that Laravel internally always grabs just the last row that matches the primary key. This meant that I couldn't manually filter these results.

So here I just add a simple sort to make sure the store_id I want is always last in the list, followed by the fallback. Initially I was going to sort it using orderByRaw("FIELD(eav_attribute_option_value.store_id,0,{$currentstore_id})") to push the other store values down, but instead I ended up just filtering the other store values out first and then sorting for simplicity.

@Jade-GG Jade-GG changed the title [5.x] Abuse internal workings of Laravel to get store-specific values [5.x] Only get store-specific values for options Mar 4, 2026
indykoning
indykoning previously approved these changes Mar 6, 2026
@royduin
Copy link
Copy Markdown
Member

royduin commented Mar 10, 2026

The order changed in the specs table, that's correct?

@Jade-GG
Copy link
Copy Markdown
Collaborator Author

Jade-GG commented Mar 10, 2026

The order changed in the specs table, that's correct?

Looks like the ordering by sort_order was missing. Fixed it here.

@royduin
Copy link
Copy Markdown
Member

royduin commented Mar 10, 2026

Seems like the order is still incorrect, follow-up: RAP-1858

@Jade-GG Jade-GG force-pushed the feature/store-specific-options branch from 31fcf9d to 7cc013e Compare March 18, 2026 10:38
@Jade-GG
Copy link
Copy Markdown
Collaborator Author

Jade-GG commented Mar 18, 2026

I've fixed the ordering (it was inconsistent between mysql versions) but the playwright test is having some issues. Will rerun those tests later.

@royduin royduin merged commit d479a3a into master Mar 24, 2026
@royduin royduin deleted the feature/store-specific-options branch March 24, 2026 10:37
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.

3 participants