Develop > Controller layer > Application developer > Currency
Changing JSP files to select a preferred currency
You can allow customers to select a preferred currency from a list of supported currencies.
Procedure
- Determine the store pages, and their associated JSP files, for which to create a list of currencies.
- For every page that a list is to display, open the JSP file of that page.
- To add a preferred currency list at the store level, use the following query as an example. This query gets a list of currencies from which customers can choose their preferred currency.
<%@ page import="com.ibm.commerce.price.utils.*" %> <%@ page import="com.ibm.commerce.common.objects.*" %> <%@ page import="com.ibm.commerce.server.*" %> <%@ page import="com.ibm.commerce.command.*" %><% CommandContext commandContext = (CommandContext) request.getAttribute(ECConstants.EC_COMMANDCONTEXT); StoreAccessBean storeAB = commandContext.getStore(); CurrencyManager cm = CurrencyManager.getInstance(); String[] supportedCurrencies = cm.getSupportedCurrencies(storeAB); %>After the customer has chosen a currency, you can set it by invoking the SetCurrencyPreference command.
Related concepts
Related tasks
Related reference