Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems while importing json with matrix data #1377

Open
Humbi1992 opened this issue Nov 6, 2023 · 5 comments
Open

Problems while importing json with matrix data #1377

Humbi1992 opened this issue Nov 6, 2023 · 5 comments
Labels

Comments

@Humbi1992
Copy link

Humbi1992 commented Nov 6, 2023

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:
  • 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>
  1. Execude Feed
  2. 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
@Humbi1992 Humbi1992 added the bug label Nov 6, 2023
@i-just
Copy link
Contributor

i-just commented Nov 22, 2023

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
Copy link
Author

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
Copy link
Contributor

i-just commented Dec 6, 2023

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
Copy link
Author

Humbi1992 commented Dec 11, 2023

@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
Copy link
Contributor

i-just commented Dec 11, 2023

Ok, so Feed Me doesn’t support nested Matrix + Super Table (more info can be found, e.g. here: #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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants