Is it possible to use custom XML file structure to import data?
All Import modules provide the functionality of creating your own XML file via special XSLT editor:
The XLS template configuration depends on the user requirements, however, below provided the example of the XLS template:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:g="http://base.google.com/ns/1.0">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="custom_items_name">
<xsl:element name="items">
<xsl:for-each select="custom_item_name">
<xsl:element name="item">
<sku><xsl:value-of select="sku" /></sku>
<type_id><xsl:value-of select="type_id" /></type_id>
<attribute_set_id><xsl:value-of select="attribute_set_id" /></attribute_set_id>
<xsl:element name="catalog_product_attribute">
<xsl:element name="item">
<price><xsl:value-of select="price" /></price>
<name><xsl:value-of select="name" /></name>
<description><xsl:value-of select="description" /><description>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Further listed several peculiarities that should be taken into account during the creation of the template:
1. The next bold lines of code represents the nesting level in the import file that maps with the set Data XPatch in the import profile:
<xsl:template match="custom_items_name">
<xsl:element name="items">
<xsl:for-each select="custom_item_name">
<xsl:element name="item">
2. Fields from the Root entity can be added without setting the entity name:
But fields from other entities must be added in a separate "element" node:
The sample import file for the above shared configuration looks like so: