Help with template variables



  • Official comment
    Robert K.

    Hello Rob,

    Thank you for your inquiry about our templates. I will lead off by answering your last question.

    The best way to see which fields can go into a template from an order is to take a look at the XML Source for said order. You may see the order XML by selecting an order and going to Output > Save & Open > System > Utility > XML Source. The resulting file will list the possible values to be displayed in a template from the selected order.

    Here are paths for the fields you asked for (starting at the Order level of the XML).

    Custom field 1: <xsl:value-of select="//Order/CustomField1"/>

    Processed Date (formatted using the ShipWorks short date function, note that this will fail if attempted to be used with non-processed shipments): <xsl:value-of select="sw:ToShortDate(//Order/Shipment/ProcessedDate)"/>

    Service Used: <xsl:value-of select="//Order/Shipment/ServiceUsed"/>

    If you have any further template questions please let me know and I will be happy to provide clarification and, if necessary, open a support ticket on your behalf.

    Thank you,

    Robert K

    Comment actions Permalink
  • Avatar
    Ricki Welsch

    Thank you!  Is there a way to get Carrier and Service Used separately? 




    instead of UPS GROUND

    Comment actions Permalink
  • Avatar
    Jacob Hutter

    Hey Rob,

    In Order to separate the Carrier Name from the service, we'll have to remove it from the tag with XSLT Code. Although it looks like a lot, the code is clean and simple!

    Feel free to Copy/Paste the code below to look for USPS, FedEx, and UPS' Service w/o the Carrier name:

    <xsl:if test="contains(//ServiceUsed, 'UPS')" >
       <xsl:value-of select="substring-after(//ServiceUsed, 'UPS ')" />
    <xsl:if test="contains(//ServiceUsed, 'FedEx')" >
       <xsl:value-of select="substring-after(//ServiceUsed, 'FedEx ')" />
    <xsl:if test="contains(//ServiceUsed, 'USPS')" >
       <xsl:value-of select="substring-after(//ServiceUsed, 'USPS ')" />

    Don't hesitate to let us know if we can further assist!

    Bet Regards,

    Jake H

    -Let's Do It!

    Comment actions Permalink
  • Avatar
    Ricki Welsch

    Thank you! 


    I'm trying to make a report that creates a csv file. Everything is working fine except for one thing that I can't seem to pull off. 

    I am making csv that is for invoice uploading. So it needs to breakdown evey order on multiple lines if need depending on how many skus were ordered. Near the end I need to display the Order Total on each line item. But "Total" in this case seems to equal Total of unit price for the line items on that line and not Order Total. I've tried Total, //Order/Total and a million other things to try to get Unit Price and Order Total to co-exist on the same line item. 




    <xsl:for-each select="Customer/Order/Item">

    <!-- order id / date -->

    <xsl:text>"</xsl:text><xsl:call-template name="OrderNumber"><xsl:with-param name="order" select=".." /></xsl:call-template><xsl:text>",</xsl:text>
    <xsl:text>"</xsl:text><xsl:call-template name="OrderNumber"><xsl:with-param name="order" select=".." /></xsl:call-template><xsl:text>",</xsl:text>
    <xsl:text>"</xsl:text><xsl:value-of select="sw:FormatDateTime(//Generated, 'yyyy-MM-dd')" /><xsl:text>",</xsl:text>
    <xsl:text>"</xsl:text><xsl:value-of select="sw:FormatDateTime(//Order/Shipment/ProcessedDate, 'yyyy-MM-dd')" /><xsl:text>",</xsl:text>

    <!-- line item info -->

    <xsl:text>"</xsl:text><xsl:value-of select="SKU" /><xsl:text>",</xsl:text>
    <xsl:text>"</xsl:text><xsl:value-of select="Quantity" /><xsl:text>",</xsl:text>
    <xsl:text>"</xsl:text><xsl:value-of select="format-number(UnitPrice, '#,##0.00')" /><xsl:text>",</xsl:text>

    <!-- order total -->
    <xsl:text>"</xsl:text><xsl:value-of select="//Order/Total" /><xsl:text>",</xsl:text>


    Comment actions Permalink
  • Avatar
    Ricki Welsch

    Sorry just got it..   ../Total 

    Comment actions Permalink

Please sign in to leave a comment.