Closed bavodeclercq closed 3 months ago
Hi @bavodeclercq
Could you try updating Commerce to the latest version (5.0.12.2
) and let me know if you still see these issues?
There were also a couple of fixes in Craft itself that I think might be related to what you are seeing. These fixes were included in the 5.2.6
release of Craft.
If you could update Craft as well and see if the issues persist?
Thanks!
Hi @nfourtythree
I have updated Commerce to the latest version (5.0.12.2) and Craft to version 5.2.6, but the issue still persists on both product and variant levels.
Thanks for reporting this, @bavodeclercq. It should be fixed now for the next Craft release.
To test, change your craftcms/cms
requirement in composer.json to:
"craftcms/cms": "5.x-dev as 5.2.6",
Then run composer update
.
Hi @brandonkelly
Thank you for the fix. I tested it and the issue is resolved at the product level. However, the problem still persists at the variant level.
Hey @bavodeclercq, can you run composer update
again?
Craft 5.2.7 is out with the fix for this. Thanks for reporting!
After the latest update, the issue is now also fixed for variants. Thanks!
What happened?
Description
I have a matrix field used as a content builder with the view mode set to cards. When I add this matrix field to the product fields and/or variant fields of a product type, I can add blocks without any issues. However, when I attempt to edit a block, I encounter the following errors:
Product Fields:
Calling unknown method: craft\commerce\elements\Product::getOwner()
Variant Fields:
craft\models\FieldLayout::getFieldByld(): Argument craftcms/commerce#1 ($id) must be of type int, null given, called in /var/www/html/vendor/craftcms/cms/src/services/Elements.php on line 3872
Additionally, if I change the view mode of the matrix field to inline-editable blocks, I can save without errors, but the changes are not stored. (This may have worked correctly the first time, but after switching back to card view, the blocks appeared as edited, and I discarded the changes. Since then, changes are not saved. I don't recall if it worked correctly before, but I think it did.)
Steps to reproduce
Expected behavior
Editing a block in the matrix field should not result in errors, and changes should be saved correctly.
Actual behavior
Editing a block in the matrix field results in errors for both product and variant fields, and changes are not saved when switching to inline-editable view mode.
Craft CMS version
5.2.5
Craft Commerce version
5.0.11.1
PHP version
8.3.8
Operating system and version
Linux 6.9.6-orbstack-00147-gb0567c7c0069
Database type and version
MySQL 8.0.36
Image driver and version
Imagick 3.7.0 (ImageMagick 6.9.11-60)
Installed plugins and versions