-
Notifications
You must be signed in to change notification settings - Fork 139
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
Matrix field not importing correctly, ignoring feed configuration for fields #674
Comments
I'm having the same problem I think. Similar feed (RSS/XML) provides full asset URL as a node within a matrix compatiable structure, when running the feed the asset field is blank. From debugging so far, I have found Feed Me is being told to return here, because fieldInfo doesn't return the urlOrPath key: https://github.com/craftcms/feed-me/blob/develop/src/elements/Asset.php#L118-L123 It never makes it past this part, so a download of the file is never attempted. Those keys that Feed Me is looking for only appear when the element type is set to "Asset", it looks in both our cases we are using the asset field when the element type is "Entries". |
I have the exact same problem. A text field within the Matrix block is processed correctly but the Asset field inside that same block is ignored. |
After further debugging: The issue is only present when a field of the Matrix has been mapped with a Default Value and the Feed element is set to "Use default value". All the fields (inside the Matrix block) that follow this field with a default value will be ignored. My temporary solution was to add the default value directly in the CSV/RSS/JSON feed and map the Matrix field that used "Use default value" to that element of the feed. And In my opinion this is the condition that causes the issue: Line 182 in 772387e
|
I'm having what I believe is the same issue -- matrix fields won't populate from defaults set in Feed Me. As above, I also confirm the "Use default value" option is correctly selected in addition to filling out the default value in Feed Me. (I noticed a closed ticket where this was the issue, and I'm confirming it doesn't apply here.) Note that the issue for me is present regardless of the mapping mentioned in the previous post. |
Not sure if this is the same issue, but I ran into an issue with importing that was caused by using a default field: I had a matrix field with two block types: BT1 and BT2. In BT1 I had 2 fields: heading and headingLevel. When I set up my feed import, I mapped the heading field to an xml node and set headingLevel to use a default value. I had all the fields in BT2 mapped to respective xml nodes (table field). When I imported, blocks were created for all my block nodes, but all of them were set to type of BT1 (any fields in BT2 were not imported). XML:
Log output:
As you can see "new2" should have been of type BT2, but instead is BT1 and is looking for fields related to BT1. When I added a node for headingLevel in the XML and mapped it (instead of using default) as suggested by @pierrestoffe, the feed ran perfectly. If this is a different, albeit related, issue, I'm happy to open a new ticket. |
I probably had the same issue as some of you describe here. There's definitely something wrong with the 'use default value' as it's not working at all in matrix blocks and disturbs everything else. Causing fields to be filled with the wrong data and even adding the wrong blocktypes. I have the 'use default value' set in the dropdown. I did lots of tests back and forth and these are my findings. My findings:
These findings are seen with lots of tests on imports where no previous entry data existed (erased right before import). The strategy was both on 'Create new elements' and 'Update existing elements', so the same as in the online examples for matrix blocks. And the imported data is also in the exact same format as the online examples. And also works fine when no 'use default value' is used inside any of the blocks. It took me two days to figure out what's going on and why the imports were not working as expected. And I had to check all my data and tried many things to make it work just to find out it's an issue in the 'use default value' part of the importer. That wasn't fun. Hopefully it could get fixed so we don't have to have doubts on our import data and can use default values!! Thanks in advance! Plugin version: 4.2.3 |
Importing images via full URL to Matrix blocks - I’m no longer able to replicate this, but I have verified that it works in the latest v4 and v5 versions of the plugin. Importing images to Matrix blocks via “Use default value” - there’s definitely something wrong there. I’m looking into it. Also, there’s a new feature, which you might find helpful: “Set empty values”. It will be imported as expected if it’s “on”, the mapped value is empty and the default is specified. Finally, more of a side note, importing matrix blocks - in v5 (for Craft 4), you can match your data to matrix block type by handle; see #1226 for more info. |
Fixed in #1282 for the next v4 and v5 releases. |
Description
Apologies as I may be misinterpreting the documentation but for CSV and XML format feeds (following the provided documentation for XML feeds, configuring the CSV feeds as you would for any other entity) matrix fields are created without the correct data or default data being set.
On importing entity with matrix field configuration is ignored resulting in a "blank" item being added.
Thanks for any help in advance :)
Steps to reproduce
Additional info
Example configuration:
Output in log:
{"new1":{"type":"treatmentImageItem","enabled":true,"collapsed":"1","fields":{"isPrimaryImage":false}}}
As you can see, the imageSource field is not included in the payload and the isPrimaryImage field is set to the incorrect value.
Sample XML node:
The text was updated successfully, but these errors were encountered: