Cart Values - Eonic/ProteanCMS GitHub Wiki

Cart Functions in XSLT

This section outlines key XSLT variables related to cart functionalities such as currency, symbols, query strings, and language settings. Each variable is defined to provide a default value or handle dynamic data from the cart.


Currency

Description: This variable sets the currency for the current cart. If no currency is explicitly defined in the cart data, it defaults to GBP.

<xsl:variable name="currency">
    <xsl:choose>
        <xsl:when test="/Page/Cart">
            <xsl:value-of select="/Page/Cart/@currency"/>
        </xsl:when>
        <xsl:otherwise>GBP</xsl:otherwise>
    </xsl:choose>
</xsl:variable>

Currency Code

Description: Retrieves the currency code used in the cart. If no currency is provided, the default code is set to GBP.

<xsl:variable name="currencyCode">
    <xsl:choose>
        <xsl:when test="/Page/Cart">
            <xsl:value-of select="/Page/Cart/@currency"/>
        </xsl:when>
        <xsl:otherwise>GBP</xsl:otherwise>
    </xsl:choose>
</xsl:variable>

Currency Symbol

Description: Extracts the currency symbol (e.g., £, $, €) from the cart. If no symbol is set, the pound symbol (£) is used by default.

<xsl:variable name="currencySymbol">
    <xsl:choose>
        <xsl:when test="/Page/Cart">
            <xsl:value-of select="/Page/Cart/@currencySymbol"/>
        </xsl:when>
        <xsl:otherwise>£</xsl:otherwise>
    </xsl:choose>
</xsl:variable>

Query Symbol

Description: Defines the query string symbol used in URLs. It determines whether to use an ampersand (&) for subsequent query parameters when the page is in admin mode, or a question mark (?) otherwise.

<xsl:variable name="querySymbol">
    <xsl:choose>
        <xsl:when test="/Page/@adminMode">&amp;</xsl:when>
        <xsl:otherwise>?</xsl:otherwise>
    </xsl:choose>
</xsl:variable>

Page Language

Description: Sets the language of the page based on various factors. It first checks if the page content has a defined language, then checks user settings, and finally defaults to a translation language if nothing is specified.

<xsl:variable name="pageLang">
    <xsl:choose>
        <xsl:when test="/Page/Contents/Content[@name='XmlLang']">
            <xsl:value-of select="Contents/Content[@name='XmlLang']"/>
        </xsl:when>
        <xsl:when test="@userlang and @userlang!=''">
            <xsl:value-of select="@userlang"/>
        </xsl:when>
        <xsl:otherwise>
            <xsl:value-of select="@translang"/>
        </xsl:otherwise>
    </xsl:choose>
</xsl:variable>

Back to Functions.xsl


⚠️ **GitHub.com Fallback** ⚠️