craftcms / feed-me

Craft CMS plugin for importing entry data from XML, RSS or ATOM feeds—routine task or on-demand.
Other
286 stars 140 forks source link

Problems while importing json with matrix data #1377

Open Humbi1992 opened 8 months ago

Humbi1992 commented 8 months ago

Description

I'm having problems importing my json file which contains matrix fields.

Steps to reproduce

  1. 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"
                }
            ]
        }
    }
],
...
  1. Map:
  1. Execude Feed
  2. It will ignore arguments array

Additional info

i-just commented 7 months ago

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?

Humbi1992 commented 7 months ago

Hello @i-just

I collected the following information for you:

My Field Structure:

Benefits (SuperTable) -- Arguments (Matrix) ---- Argument (Matrix Element)

image

As first item i selected products, like in the Screenshot below: image

i-just commented 7 months ago

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)?

Humbi1992 commented 6 months ago

@i-just

Here the feedme.log after the import:

feedme.log

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.

i-just commented 6 months ago

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 support@craftcms.com so I can try to replicate this and dig deeper?