Include Store name in report template?
AnsweredI am trying to create a report that includes Order #, SKU, and some other order info as well as the name of the store instance (Amazon, Etsy, BC, etc). It all works fine except for the Store Name - if all of the orders that I select are from the same store, then the store name outputs correctly. However, if the orders are from a mix of stores, it assigns one store name to all of the orders. I have yet to figure out how it's determining which store to report when it does that. Below is the code I'm using for the template. Anyone out there able to see what might be the problem with it? I suspect it has to do with being in the correct root folder or something along those lines, but I have no idea how to fix it. Any help would be much appreciated!!
<!DOCTYPE xsl:stylesheet[ <!ENTITY nl "
"> ]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sw="http://www.interapptive.com/shipworks" extension-element-prefixes="sw">
<xsl:import href="System\Snippets" />
<xsl:output method="text" encoding="utf-8" />
<!-- Start of template -->
<xsl:template match="/"><xsl:apply-templates /></xsl:template>
<xsl:template match="ShipWorks">
<xsl:text>"Order #","SKU","Qty","Ship State","Ship Country","Notes","Store",&nl;</xsl:text>
<xsl:for-each select="Customer/Order">
<xsl:variable name="ship" select="Address[@type='ship']" />
<!-- line item info -->
<xsl:text>"</xsl:text><xsl:value-of select="Number" /><xsl:text>",</xsl:text>
<xsl:text>"</xsl:text><xsl:value-of select="Item/SKU" /><xsl:text>",</xsl:text>
<xsl:text>"</xsl:text><xsl:value-of select="Item/Quantity" /><xsl:text>",</xsl:text>
<!-- shipping address info -->
<xsl:text>"</xsl:text><xsl:value-of select="$ship/StateCode" /><xsl:text>",</xsl:text>
<xsl:text>"</xsl:text><xsl:value-of select="$ship/CountryCode" /><xsl:text>",</xsl:text>
<xsl:text>"</xsl:text> <xsl:value-of select="Note[Visibility='Internal']/Text" /><xsl:text>",</xsl:text>
<xsl:text>"</xsl:text><xsl:value-of select="../../Store/StoreName" /><xsl:text>",</xsl:text>
<xsl:text>&nl;</xsl:text>
<xsl:text></xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
-
Official comment
Thank you for reaching out Michael!
I have transferred your code to my ShipWorks, and exported orders from multiple stores.
I am facing the same issue that you are having, although I do have a couple ideas for a proper solution!
I am currently creating a ticket for us to exclusively communicate with.
You will be hearing from me shortly!
Also, Shout Out to Nathan for conducting ShipWorks testing. Seriously, thank you for the additional feedback/verification!
Comment actions -
Thanks for visiting the ShipWorks forum! This was solved in a private ticket using the following variables:
<xsl:for-each select="Customer/Order/Item">
<xsl:variable name="order" select=".." />
<xsl:variable name="store" select="/ShipWorks/Store[@ID = $order/@storeID]" /><xsl:text>"</xsl:text><xsl:value-of select="$store/StoreName" /><xsl:text>"</xsl:text>
</xsl:for-each>
-
Actually, that variable worked but for some reason was extremely slow when processing a large number of orders. I tried it on 7000 orders and after 15 minutes it was still processing. I ended up modifying it as shown below and that seemed to solve the problem!
<xsl:for-each select="Customer/Order">
<xsl:variable name="order" select="." />
<xsl:variable name="store" select="/ShipWorks/Store[@ID = $order/@storeID]" />
<xsl:variable name="ship" select="Address[@type='ship']" /><xsl:text>"</xsl:text><xsl:value-of select="$store/StoreName" /><xsl:text>"</xsl:text>
</xsl:for-each>
Please sign in to leave a comment.
Comments
5 comments