feed-me
feed-me copied to clipboard
Mapping issue if custom field has the same handle as the element's attribute
Description
If you have an element with an attribute and then create a field with a handle that’s the same as the attribute and try to map the attribute to a node in the feed and that field to another node in the feed, the first mapping will be overwritten with the second one.
For example, the User element has a preferredLocale attribute.
Steps to reproduce
- Create a custom field with a handle
preferredLocale(e.g. plain text field) - Add that field to Settings > Users > Fields
- Create a feed for User element
- Use the json pasted below
- Map
preferredLocaleattribute topreferredLocalenode from the json - Map
preferredLocalecustom field tocustomFieldPreferredLocalenode from the json - Save your mapping and view it again
- Both
preferredLocaleattribute and custom field are mapped tocustomFieldPreferredLocale
JSON:
{
"users": [
{
"username": "u1",
"email": "[email protected]",
"photo": "",
"preferredLocale": "es",
"customFieldPreferredLocale": "my custom field value"
},
{
"username": "u2",
"email": "[email protected]",
"photo": "",
"preferredLocale": "en",
"customFieldPreferredLocale": "my custom field value"
},
{
"username": "u3",
"email": "[email protected]",
"photo": "",
"preferredLocale": "",
"customFieldPreferredLocale": ""
},
{
"username": "u4",
"email": "[email protected]"
}
]
}
Additional info
- Craft version: 3.8.8 and 4.4.8
- PHP version: 8
- Database driver & version: n/a
- Plugins & versions: Feed Me 4.6.2 and 5.1.2