Hide menu Last updated: Oct 24 2016
Area: Episerver Commerce Applies to versions: 10 and higher
Other versions:

Markets

This topic describes the Market concept, which is central to Episerver Commerce. A single site can have multiple markets, each with its own product catalog, language, currency, and promotions.

Classes in this topic are available in the Mediachase.Commerce or Mediachase.Commerce.Markets namespaces.

CurrentMarket interface

Sites that implement multi-market functionality must also implement the ICurrentMarket interface. The ICurrentMarket implementation must return the market of the current request, and is called to get the appropriate market for the execution of most market-sensitive business logic. You register custom ICurrentMarket implementations at the application's initialization step by implementing IConfigurableModule.

A business's market segmentation strategy determines its implementation of the ICurrentMarket interface. If your business segments markets geographically, you may want to use a prestitial page, an IP geolocation service, or a simple drop-down control to determine a user's region and market.

Markets are not constrained to a region; a business-to-business is likely to permit only authenticated users to use the system, and may assign a market to each customer when the customer is created. In this case, the ICurrentMarket implementation's retrieval of the current market is based on the current authenticated user.

The default, supplied implementation of ICurrentMarket always returns the default market. This is the correct behavior for sites that do not implement multi-market functionality.

The ICurrentMarket interface

public interface ICurrentMarket
{
    // Gets the current market.
    IMarket GetCurrentMarket();
}

Market definition

A market is represented by an instance of the IMarket interface. The data associated with each market is typically used as a set of guidelines for regional markets. However, the market system is not specifically tied to a region; and languages and currencies are not automatically filtered based on the value of the current market. You can use the MarketImpl class as a default implementation of the IMarket interface.

There always is a default market, with ID MarketId.Default. You can disable this market for sites that implement multi-market functionality, but do not delete it.

Interacting with markets

Access market data with the IMarketService API, which exposes simple create/replace/update/delete operations for market data.

Markets, orders, carts, and wishlists

To enable processing when the ICurrentMarket implementation may not be available, orders, carts, and wishlists include a market ID.

Carts are market-dependent, so are unique to a user and market, instead of just a user. If a site lets a user switch markets, then switching the market may also switch associated carts to a new or different carts. Because wishlists are carts, this also applies to wishlists.

Comments