feed-me
feed-me copied to clipboard
Problems while importing json with matrix data
Description
I'm having problems importing my json file which contains matrix fields.
Steps to reproduce
- Create an JSON File with following content:
...
"Benefits": [
{
"Shortcut Title": "Shortcut Title",
"Full Title": "Title",
"Arguments": {
"Argument Elements": [
{
"Subtitle": "Subtitle",
"Paragraph": "This is a paragraph",
"Picture": "image01.png",
"Picture Alt Text": "This is Image 01"
},
{
"Subtitle": "Subtitle",
"Paragraph": "This is a paragraph",
"Picture": "image02.png",
"Picture Alt Text": "This is Image 02"
}
]
}
}
],
...
- Map:
- Argument: Subtitlearguments[argument][subtitle] | <Benefits/Arguments/Argument Elements/Subtitle>
- Argument: Paragrapharguments[argument][paragraph] | <Benefits/Arguments/Argument Elements/Paragraph>
- Argument: Picturearguments[argument][picture] | <Benefits/Arguments/Argument Elements/Picture>
- Argument: Picture Alt Textarguments[argument][pictureAltText] | <Benefits/Arguments/Argument Elements/Picture Alt Text>
- Execude Feed
- It will ignore arguments array
Additional info
- Craft version: 4.5.5
- PHP version: 8.0
- Database driver & version: mysql 5.7.39
- Plugins & versions: 5.2
Hi, thanks for getting in touch!
Can you please let me know what you have selected as the “Primary Element” on the second screen when setting up a feed (a screenshot would be nice)?
Also, just so that we’re on the same page, is your matrix field called “Arguments” and has a block type called “argument”, and the block has a “subtitle” field (e.g. plain text), “paragraph” field (e.g. plain or rich text) and “picture” Assets field and the volume for it has “picture alt text” field in its field layout - is that correct?
Hello @i-just
I collected the following information for you:
My Field Structure:
Benefits (SuperTable) -- Arguments (Matrix) ---- Argument (Matrix Element)
As first item i selected products
, like in the Screenshot below:
Thanks for the additional info. After running your feed, do you see any errors in the Logs tab (or in the storage/logs/feedme.log
file)?
@i-just
Here the feedme.log after the import:
Unfortunately, no real indication of an error or similar.
I tried to reformat the JSON into this:
"Benefits": [
{
"Full Title": "",
"Shortcut Title": "",
"Arguments": [
{
"Subtitle": "",
"Paragraph": "",
"Image": ""
},
....
But still doesn't work for me.
Ok, so Feed Me doesn’t support nested Matrix + Super Table (more info can be found, e.g. here: https://github.com/craftcms/feed-me/issues/771). That said, this usually results in a telltale error: Call to a member function getBlockTypeFields() on null - Matrix.php
, which is what I’m getting in my tests and why I asked if you saw any after the feed is run.
Can you send the composer.lock
, composer.json
, database export and a JSON feed file (with just one full element) to [email protected] so I can try to replicate this and dig deeper?