Not sure if you ever ran into the document named "ASPDNSF ERP Provider SyncV3.pdf". I don't have a link but I downloaded it from here somewhere.
Anyways... there's a section as follows:
To add a new category with a Name, XPath (used to specify location in the category is a
child of another category), Description, XmlPackage, and Published value, you could use
as follows:
Code:
XElement xeImport = new XElement("AspDotNetStorefrontImport", new XAttribute("Version",
"7.1"));
XElement xeCategory = new XElement("Entity",
new XAttribute("Action", "Add"),
new XAttribute("EntityType", "Category"),
new XElement("Name", "CategoryName"),
new XElement("XPath", "/Main Category/Sub Category/CategoryName"),
new XElement("Description", new XCData("category description")),
new XElement("Display",
new XElement("XmlPackage", "entity.gridwithprices.xml.config")),
new XElement("Published", true));
xeImport.Add(xeCategory);
DoIt(xeImport.ToString(SaveOptions.DisableFormatting));
The resulting xeImport in this case would be:
Code:
<AspDotNetStorefrontImport Version="7.1">
<Entity Action="Add" EntityType="Category">
<Name>CategoryName</Name>
<XPath>/Main Category/Sub Category/CategoryName</XPath>
<Description><![CDATA[category description]]></Description>
<Display>
<XmlPackage>entity.grid.xml.config</XmlPackage>
</Display>
<Published>true</Published>
</Entity>
</AspDotNetStorefrontImport>
I'm running into the same issue myself, and I'm about ready to test it. I agree though, it would make much more sense to be able to specify a ParentID for the entity.