When using the Sprout Import plugin, how do you place an imported entry underneath a specific parent entry in a structure section?
1 Answer
Turns out you can set the "parentId"
field under the "attributes"
list in the import JSON data to set a structure parent (to the entry id of the parent entry). This probably means you need to chunk your import into separate steps, for example:
- Import only the top-level entries.
- Run a query on the CMS to retrieve entry id's for those just-imported top-level entries.
- Using the list from step 2, assign the proper entry id to the 2nd-level children and import those.
- Run a query to get the 2nd-level entries you just imported.
- etc. etc. for each level of your hierarchy
Would be awesome if you could just nest the JSON structures and the import plugin magically figured out how to set parent ids, but that sounds like a lot of work to implement for a free plugin :)