ImportDefinitions plugin - import hierarchy of objects


I have simply CSV with names:
Category and Subcategory are objects class A
Product is object class B

I define Import of CSV Provider and Class B. Is it possible (using only existing interpreters and setters) import and create objects of category and subcategory (class A) in the same import, then set product as child of subcategory object?
I assume I don’t know the parent ID before I create the category tree.

If anyone has experience with similar problem, I will be grateful for advice. :slightly_smiling_face:


Actually yes, you can call sub-definitions.

You have todo following:

  • Create a new definition called category and select class A with provider raw
  • In the settings you define the same schema as you have in your parent definition
  • Go back to your product definition
  • Create a new mapping for the categories field. I assume it is a multihref
  • Use interpreter nested
  • Add a new one
  • Use expression with the config [data['category'], data['subcategory']]
  • Add a new one to nested
  • Use definition
  • Choose your category definition.

You also have to create the sub-category in your category definition in a similar way, I hope you get the idea. It is a bit confusing and also complicated.


Thanks for your help Dominik! It works good.
I used mapping for the (sub)category in field o_parent and in this way Pimcore created tree of objects.