Fix setting custom fields in variant collection#3931
Fix setting custom fields in variant collection#3931boboldehampsink wants to merge 1 commit intocraftcms:5.xfrom
Conversation
|
Thank you for bringing this to our attention and taking the time to create a PR we really appreciate it. I am going to close this PR in favour of the fix in PR #3946 Thanks! |
|
The fix in PR #3946 has now been released in Commerce 5.3.6. Thanks! |
|
This release has other issues for me. Now this is broken: $variant = [
'relatedTo' => [
'targetElement' => [EntryQuery::find()],
'field' => 'products',
],
'orderBy' => 'isDefault DESC',
];
return Product::find()
->hasVariant($variant)
->with([
['variants', [
...$variant,
'limit' => 1,
]],
])->all();Could this have anything to do with this fix? 5.3.5 works fine. |
|
I have just added a test to the suite which eager loads the variants: 1df2cad At the moment it looks like this is behaving as expected. I understand your example was probably partial pseudo-code/simplified, so could you explain what you were trying to do with the query so I can make sure to test it thoroughly. As for one example you have Thanks! |
|
Oh yeah I meant that, it is indeed pseudo-code. The problem is in the "hasVariant" method, when I remove it I get results. With that in place, no results. And this works fine in 5.3.5. |
|
Is it just flipping between the Commerce versions and keeping the same CMS version that shows the difference? Or is the CMS version changing as well? Are you able to xdebug or use the debug toolbar to extract the raw query to see what the difference is? Between 5.3.5 and 5.3.6 we didn't make any changes specifically to querying so in theory there shouldn't be a difference. But I am keen to get to the bottom of the issue you are seeing |
|
Only changing Commerce versions. I will look into it some more. |
This comment was marked as outdated.
This comment was marked as outdated.
|
And, to follow along with this, you have a Would it be possible to send your tests directory to [email protected]? That might be the easiest way for us to trace through what could be happening here. |
|
I sent you a mail 👍 |
Description
Now also sets custom field values in variant collection, not only attributes
Related issues
Fixes #3927