Common Syntax Values to Modify a Template's Tokenized Fields
ShipWorks gives you the ability to use tokenized fields that add small lines of code to your shipping provider's default settings. With these, you include additional information on your printed shipping labels. For example, you can print the order number on the label, or perhaps you can print the item information and quantity on the label to help your warehouse team pick products. Here we detail some of the more commonly used attributes.
For instructions on where to find these fields for each shipping provider and for instructions on how to update them with the following attributes, please see our article on How to Find Memo Fields / Reference Fields/ Rubber Stamps.
For your document to display the order number, record, or ID, copy and paste this value:
Order Number
In a reference/tokenized field: {//Order/Number}
In template code/tokenized field: <xsl:value-of select="//Order/Number" />
eBay Record Number
In a reference/tokenized field: {//Order/eBay/SellingManager/RecordNumber}
In template code/tokenized field: <xsl:value-of select="//Order/eBay/SellingManager/RecordNumber" />
Amazon ASIN
In a reference/tokenized field: {//Order/Item/Amazon/ASIN}
In template code/tokenized field: <xsl:value-of select="//Order/Item/Amazon/ASIN" />
Amazon Order ID
In a reference/tokenized field: {//Order/Amazon/AmazonOrderID}
In template code/tokenized field: <xsl:value-of select="//Order/Amazon/AmazonOrderID" />
These values will only output the first line item (if more than one line item exists).
Item Name
For your document to display a line item name (or description), copy and paste this value:
In a reference/tokenized field: {//Order/Item/Name}
In template code/tokenized field: <xsl:value-of select="//Order/Number" />
Item Quantity
For your document to display the line item's quantity, copy and paste this value:
In a reference/tokenized field: {//Order/Item/Quantity}
In template code/tokenized field: <xsl:value-of select="//Order/Item/Quantity" />
Item SKU
For your document to display the line item's SKU (or Item Code), copy and paste this value:
In a reference/tokenized field: {//Order/Item/SKU}
In template code/tokenized field: <xsl:value-of select="//Order/Item/SKU" />
Code and SKU are Interchangeable
SKU and Code share the same spot in the XML source. Anywhere Code
gets used in the XML source can be replaced with SKU
.
Use a value like {Name}
or {SKU}
without the full path to get all existing line items (Name, SKU, etc). These values will only output the first line item (if more than one line item existed) and you specify the full path, for example with {//Order/Item/Name}
.
Multiple Item Names
This value will display multiple line item names, descriptions, or both. If multiple line items exist, they will be separated by commas.
-
{Name},
Multiple Item Quantities with an Item Name
This value will display the line item quantity in parentheses, followed by the item name/description. If multiple line items exist, they will be separated by commas.
-
({Quantity}) - {Name},
Multiple Item Quantities with Item Codes (SKUs)
This will output the line item quantity in parentheses, followed by the item code (SKU). If multiple line items exist, they will be separated by commas.
-
({Quantity}) - {Code},
Multiple Item Quantities with Item Codes and Item Locations
This will output the line item quantity in parentheses, followed by the item code (SKU), followed by the item's location code. If multiple line items exist, they will be separated by commas.
-
({Quantity}) - {Code} - {Location},
Code and SKU are Interchangeable
SKU and Code share the same spot in the XML source. Anywhere Code
gets used in the XML source can be replaced with SKU
.
These fields can also be useful for automatically naming reports generated from ShipWorks with the current date, timestamp, or both. For more information, see our Setting the Default File Name of a Saved Report page.
Generating the Date (example: 8_15_2017)
This outputs the current date.
-
{sw:ToShortDate(//Generated)}
Generating the current Date and Timestamp (example: 2017-08-15T14_12_20.7278676Z)
This outputs the current date along with the current time.
-
{//Generated}
-
You can use any XSLT(v1) code in any tokenized fields.
This includes Memo fields, Reference fields, and Rubber Stamps, as they may be used in Templates, Labels, and other documents.
-
All data, syntax, and combinations of both are derived from the ShipWorks XML Source template report. Find an example of this report in the ShipWorks Templates: Comprehensive Technical Guide.
-
To run an XML Source report for orders, select your order(s), click the Output tab > Preview, > XML Source (very bottom of the list).
-
Example:
<xsl:if select=”//Order/Item/UnitPrice > 10”>{//Order/Item/Name}
costs more than$10<xsl:if>
If you reference a field inside of a quoted XSLT syntax (or escape one), use curly brackets { } as noted in the example with
{//Order/Item/Name}
.
-
Still Need Help?
Please feel free to reach out to one of our awesome Technical Support Representatives in St. Louis. We are happy to help.
Have a comment to share about this article? We'd love to hear from you. You must be logged in to your Support Portal account to leave a comment.
Comments
0 comments