Currency formatting in the Aurora starter store

The Aurora starter store uses the JavaServer Pages Standard Tag Library (JSTL) API to format the currencies that are displayed on store pages.

Older WebSphere Commerce starter stores use the FormattedMonetaryAmountDataBean to format currencies based on patterns that are defined in the CURFMTDESC database table. The data bean implementation is easy to customize by updating the default patterns that are defined in the CURFMTDESC database table. In addition, the patterns can include images and HTML entities.

The Aurora starter store, however, uses web services rather than data beans to perform most store functions. Since the web services do not format currencies, the store uses the JSTL format number tag (<fmt:formatNumber>) in JSP files in combination with the shopper's locale setting to format currencies. As a result, customizing the currency format for Aurora involves changing the tagging in many JSP files.

Important: For the Aurora store, updates to the CURFMTDESC database table have no effect and the following customization instructions do not apply: Changing the currency format.

The following code snippet is an example of the JSTL implementation that sets the currency format on the shopping cart page of the Aurora store:

<span class="price">
  <fmt:formatNumber var="formattedUnitPrice" value="${orderItem.unitPrice}" type="currency" 
                    maxFractionDigits="${env_currencyDecimal}" currencySymbol="${env_CurrencySymbolToFormat}"/>
    <c:out value="${formattedUnitPrice}" escapeXml="false" />
    <c:out value="${CurrencySymbol}"/>
</span>

Currency customization options

If a shopper is viewing a store with US prices in the French language, the JSTL implementation displays the price according to the currency format for the French locale (fr_FR):
1 800,00 $
If you want to change the pattern, for example, by moving the dollar sign to the left, consider these two options:
  • Pass the pattern attribute of the <fmt:formatNumber> tag to all JSP files that display prices in the store.
  • Implement a custom tag. This option still requires an update to all JSP files that display prices. However, if you want to change the pattern in the future, you can change the custom tag itself rather than updating all the JSP files again.