Tea Commerce offers a lot of nice XSLT extension to be used in Umbraco. In this post i will walk you through the different extension, but because the xml output can be quite large for some of the methods i won’t go into details about the output. You can just do a simple <xsl:copy-of select=”teacommerce:method” /> to see the xml output

GetOrderXml

Returns the current order – if no order is present in the cart the order output is empty

<xsl:variable name="order" select="teacommerce:GetOrderXml()"/>
<xsl:if test="$order/@id != ''">
  <xsl:value-of select="$order/@name" />
  <xsl:for-each select="$order/orderLine">
    <xsl:value-of select="properties/productName" />
  </xsl:for-each>
</xsl:if>

Output example

WEB-5
Apple Speakers
Podspeaker MicroPod

GetFinalizedOrderXml

Returns the finalized order – is to be used in the shopping cart’s last step after the order is finalized

<xsl:variable name="order" select="teacommerce:GetFinalizedOrderXml()/@totalQuantity"/>

Output example

5

GetSpecificOrderXml

Returns the order with the specified id – is made to be used for testing and is also used in the default implementation of Tea Commerce – TeaCommerce/teaCommerceAdminOrder.xslt

<xsl:variable name="order" select="teacommerce:GetSpecificOrderXml( '11' )/@name"/>

Output example

WEB-11

GetFinalizedOrdersXml

Returns all finalized orders – can be used in many different cases, its just your imagination that is the limit

<xsl:for-each select="teacommerce:GetFinalizedOrdersXml()/order">
  <xsl:value-of select="@name" />
</xsl:for-each>

Output example

WEB-1
WEB-2
WEB-3

GetFinalizedOrdersXmlForMember

Returns all finalized orders for a specific member

<xsl:for-each select="teacommerce:GetFinalizedOrdersXmlForMember( umbraco.library:GetCurrentMember()/@id )/order">
  <xsl:value-of select="@name" /> - <xsl:value-of select="@totalPriceFormatted" />
</xsl:for-each>

Output example

WEB-7 - $250.00
WEB-9 - $349.00

GetCountries

Returns all countries

<xsl:for-each select="teacommerce:GetCountries()/country">
  <xsl:value-of select="@name" />
</xsl:for-each>

Output example

United States
Denmark

GetCurrencies

Returns all currencies

<xsl:for-each select="teacommerce:GetCurrencies()/currency">
  <xsl:value-of select="@ISOCode" />
</xsl:for-each>

Output example

USD
DKK
EUR

GetShippingMethods

Returns possible shipping methods for the current selected country

<xsl:for-each select="teacommerce:GetShippingMethods()/shipping">
  <xsl:value-of select="@name" /> - <xsl:value-of select="@feeFormatted" />
</xsl:for-each>

Output example

Pick up - kr. 0,00
FedEx - kr. 100,00

GetPaymentMethods

Returns possible payment methods for the current selected country

<xsl:for-each select="teacommerce:GetPaymentMethods()/payment">
  <xsl:value-of select="@name" /> - <xsl:value-of select="@fee" />
</xsl:for-each>

Output example

VISA - 10,00
Account Transfer - 0,00

GetCurrentCountry

Returns the currently selected country. I no specific country has been selected through the javascript API, the default country is returned

<xsl:variable name="currentCountry" select="teacommerce:GetCurrentCountry()" />
<xsl:if test="$currentCountry/@id ='2'">
  <xsl:value-of select="@name" />
</xsl:if>

Output example

United States

GetCurrentCurrency

Returns the currently selected currency. I no specific currency has been selected through the javascript API, current currency fallback to the default country’s currency

<xsl:variable name="currentCurrency" select="teacommerce:GetCurrentCurrency()" />
<xsl:value-of select="@cultureName" />

Output example

da-DK

FormatPrice

Formats a price with a currency symbol, based on current currency’s culture

<xsl:variable name="order" select="teacommerce:GetOrderXml()"/>
<xsl:value-of select="teacommerce:FormatPrice( $order/@totalPrice )" />

Output example

kr. 1395,00

FormatPriceNoSymbol

Formats a price without a currency symbol, based on current currency’s culture

<xsl:variable name="order" select="teacommerce:GetOrderXml()"/>
<xsl:value-of select="teacommerce:FormatPriceNoSymbol( $order/@totalPrice )" />

Output example

1395,00

FormatPriceWithSpecificCulture

Formats a decimal price with a currency symbol, based on the specified culture

<xsl:variable name="order" select="teacommerce:GetOrderXml()"/>
<xsl:value-of select="teacommerce:FormatPriceWithSpecificCulture( $order/@totalPrice, 'en-US' )" />

Output example

$249.00

FormatPriceNoSymbolWithSpecificCulture

Formats a decimal price without a currency symbol, based on the specified culture

<xsl:variable name="order" select="teacommerce:GetOrderXml()"/>
<xsl:value-of select="teacommerce:FormatPriceNoSymbolWithSpecificCulture( $order/@totalPrice, 'en-US' )" />

Output example

249.00