Hi!
Is there a way to assign set the sort order of a product group using the xslt-files in the Import/Export module? There are two files that take care of the product group import from eg. NAV, /Integration/eCommerce/XSLT/ProductGroups.xslt and ProductGroupsExt.xslt.
Is there a way to set sort order in one of these files or any other file used during import?
Best regards,
P
Developer forum
E-mail notifications
Set sort order
Per Ljung
Posted on 20/06/2011 15:08:04
Replies
Vladimir
Posted on 21/06/2011 03:14:51
Hi!
Do you tried to use <xsl:sort> element?
For example, in ProductGroupsExt.xslt:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<Categories>
<xsl:apply-templates select="/Categories/Category">
<xsl:sort select="@Name"/>
</xsl:apply-templates>
</Categories>
</xsl:template>
Best regards,
Vladimir
Do you tried to use <xsl:sort> element?
For example, in ProductGroupsExt.xslt:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<Categories>
<xsl:apply-templates select="/Categories/Category">
<xsl:sort select="@Name"/>
</xsl:apply-templates>
</Categories>
</xsl:template>
Best regards,
Vladimir
Per Ljung
Posted on 21/06/2011 08:59:29
Hi!No, it didn't work.
Do you tried to use <xsl:sort> element?
For example, in ProductGroupsExt.xslt:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<Categories>
<xsl:apply-templates select="/Categories/Category">
<xsl:sort select="@Name"/>
</xsl:apply-templates>
</Categories>
</xsl:template>
Best regards,
Vladimir
/Per
Per Ljung
Posted on 21/06/2011 09:04:33
Hi!
Do you tried to use <xsl:sort> element?
For example, in ProductGroupsExt.xslt:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<Categories>
<xsl:apply-templates select="/Categories/Category">
<xsl:sort select="@Name"/>
</xsl:apply-templates>
</Categories>
</xsl:template>
Best regards,
Vladimir
I think it would be better if I could use sorting in the xslt-code for the menu, all i need is the ID of the groups.
/Per
Vladimir
Posted on 22/06/2011 05:16:48
Yes indeed, sorting is a little harder than I expected ...
First of all, there are two kinds of groups - a top-level group (whose ancestor is shop) and subgroups. The sorting for them, is realized by different methods.
The file ProductGroups.xslt:
for the first:
<Groups>
<Group>
....
<Shop>
<ID>SHOP1</ID>
<SortOrder>nnn</SortOrder>
</Shop>
(where nnn is your preffered sort order for group)
for the second:
<Groups>
<Group>
....
<ParentGroups>
<ParentGroup>
<ID><xsl:value-of select="@ParentID"/>@@<xsl:value-of select="@ShopID"/></ID>
<SortOrder>nnn</SortOrder>
</ParentGroup>
</ParentGroups>
Altough should to tell, the top groups are not yet able to sort, because of a bug in the code - I registered it to fix asap.
Vladimir
First of all, there are two kinds of groups - a top-level group (whose ancestor is shop) and subgroups. The sorting for them, is realized by different methods.
The file ProductGroups.xslt:
for the first:
<Groups>
<Group>
....
<Shop>
<ID>SHOP1</ID>
<SortOrder>nnn</SortOrder>
</Shop>
(where nnn is your preffered sort order for group)
for the second:
<Groups>
<Group>
....
<ParentGroups>
<ParentGroup>
<ID><xsl:value-of select="@ParentID"/>@@<xsl:value-of select="@ShopID"/></ID>
<SortOrder>nnn</SortOrder>
</ParentGroup>
</ParentGroups>
Altough should to tell, the top groups are not yet able to sort, because of a bug in the code - I registered it to fix asap.
Vladimir
You must be logged in to post in the forum