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()
Stack trace:
#0 /var/www/html/vendor/craftcms/cms/src/base/Element.php(2350): yii\base\Component->__call()
craftcms/commerce#1 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(3869): craft\base\Element->__call()
craftcms/commerce#2 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(3874): craft\services\Elements->updateSearchIndex()
craftcms/commerce#3 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(3787): craft\services\Elements->updateSearchIndex()
craftcms/commerce#4 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(1170): craft\services\Elements->craft\services\{closure}()
craftcms/commerce#5 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(3498): craft\services\Elements->ensureBulkOp()
craftcms/commerce#6 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(1825): craft\services\Elements->_saveElementInternal()
craftcms/commerce#7 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(1170): craft\services\Elements->craft\services\{closure}()
craftcms/commerce#8 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(1812): craft\services\Elements->ensureBulkOp()
craftcms/commerce#9 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(1441): craft\services\Elements->duplicateElement()
craftcms/commerce#10 /var/www/html/vendor/craftcms/cms/src/services/Drafts.php(322): craft\services\Elements->updateCanonicalElement()
craftcms/commerce#11 /var/www/html/vendor/craftcms/cms/src/controllers/ElementsController.php(1713): craft\services\Drafts->applyDraft()
craftcms/commerce#12 [internal function]: craft\controllers\ElementsController->actionApplyDraft()
craftcms/commerce#13 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()
craftcms/commerce#14 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams()
craftcms/commerce#15 /var/www/html/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction()
craftcms/commerce#16 /var/www/html/vendor/craftcms/cms/src/web/Application.php(349): yii\base\Module->runAction()
craftcms/commerce#17 /var/www/html/vendor/craftcms/cms/src/web/Application.php(650): craft\web\Application->runAction()
craftcms/commerce#18 /var/www/html/vendor/craftcms/cms/src/web/Application.php(311): craft\web\Application->_processActionRequest()
craftcms/commerce#19 /var/www/html/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest()
craftcms/commerce#20 /var/www/html/web/index.php(12): yii\base\Application->run()
craftcms/commerce#21 {main} {"memory":17370864,"exception":"[object] (yii\\base\\UnknownMethodException(code: 0): Calling unknown method: craft\\commerce\\elements\\Product::getOwner() at /var/www/html/vendor/yiisoft/yii2/base/Component.php:308)"}
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
Stack trace:
#0 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(3872): craft\models\FieldLayout->getFieldById()
craftcms/commerce#1 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(3874): craft\services\Elements->updateSearchIndex()
craftcms/commerce#2 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(3787): craft\services\Elements->updateSearchIndex()
craftcms/commerce#3 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(1170): craft\services\Elements->craft\services\{closure}()
craftcms/commerce#4 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(3498): craft\services\Elements->ensureBulkOp()
craftcms/commerce#5 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(1825): craft\services\Elements->_saveElementInternal()
craftcms/commerce#6 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(1170): craft\services\Elements->craft\services\{closure}()
craftcms/commerce#7 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(1812): craft\services\Elements->ensureBulkOp()
craftcms/commerce#8 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(1441): craft\services\Elements->duplicateElement()
craftcms/commerce#9 /var/www/html/vendor/craftcms/cms/src/services/Drafts.php(322): craft\services\Elements->updateCanonicalElement()
craftcms/commerce#10 /var/www/html/vendor/craftcms/cms/src/controllers/ElementsController.php(1713): craft\services\Drafts->applyDraft()
craftcms/commerce#11 [internal function]: craft\controllers\ElementsController->actionApplyDraft()
craftcms/commerce#12 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()
craftcms/commerce#13 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams()
craftcms/commerce#14 /var/www/html/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction()
craftcms/commerce#15 /var/www/html/vendor/craftcms/cms/src/web/Application.php(349): yii\base\Module->runAction()
craftcms/commerce#16 /var/www/html/vendor/craftcms/cms/src/web/Application.php(650): craft\web\Application->runAction()
craftcms/commerce#17 /var/www/html/vendor/craftcms/cms/src/web/Application.php(311): craft\web\Application->_processActionRequest()
craftcms/commerce#18 /var/www/html/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest()
craftcms/commerce#19 /var/www/html/web/index.php(12): yii\base\Application->run()
craftcms/commerce#20 {main} {"memory":17809672,"exception":"[object] (TypeError(code: 0): craft\\models\\FieldLayout::getFieldById(): 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 at /var/www/html/vendor/craftcms/cms/src/models/FieldLayout.php:731)"}
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
- Create a matrix field with the view mode set to cards.
- Add this matrix field to the product fields and/or variant fields of a product type.
- Add blocks to the matrix field.
- Attempt to edit a block in the matrix field.
- Observe the errors mentioned above.
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
- Business Central 1.0.0
- CKEditor 4.1.0
- Colour Swatches 5.0.2
- Cookies 5.0.0
- CP Field Inspect 2.0.1
- Craft Commerce 5.0.11.1
- Elements Panel 3.0.0
- Embedded Assets 5.1.0
- Feed Me 6.1.0
- Formie 3.0.0-beta.16
- Hyper 2.0.2
- Image Resizer 4.0.0
- Knock Knock 3.0.0
- Mailchimp Transactional 2.1.0
- Maps 5.0.1
- Minify 5.0.0
- Pimlayer 1.0.0
- Retour 5.0.2
- Sentry Logger 5.0.1
- SEOmatic 5.0.4
- Sprig 3.0.2
- Translations 3.3.1
- Typogrify 5.0.1
- User Group Field 4.0.0
- UTM Tracker 3.0.0
- Vite 5.0.0
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 3872Additionally, 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