London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

Loading...
ARCHIVED This content is retired and no longer maintained. See the latest version here.

This document provides examples of how to use the ECF API to work with multi-market and warehouse features. Examples covered here are for instance how to change markets, getting prices and dsicounts for markets, listing warehouses and getting inventories per warehouse.

Multi-market features

Changing market to display

Examples of how to change and set markets to display.

Page Types

Example: Getting all available markets

C#
// Get all available markets.
ICurrentMarket _currentMarketService = ServiceLocator.Current.GetInstance<ICurrentMarket>();
var marketStorage = _currentMarketService as MarketStorage;
    var listMarket = marketStorage.GetAvailableMarkets();

Example: Getting current markets

C#
// Get current markets.
var _currentMarketService = ServiceLocator.Current.GetInstance<ICurrentMarket>();
var currentMarket = _currentMarketService.GetCurrentMarket();

Example: Setting current markets

C#
// Set current markets.
var _currentMarketService = ServiceLocator.Current.GetInstance<ICurrentMarket>();
var marketStorage = _currentMarketService as MarketStorage;
marketStorage.SetCurrentMarket(YourMarketId);

Displaying entry listing, prices and discounts per market

Examples of how to display the entries listed with pricing and discount for a selected market.

Page Types

Page Types

Example: Getting the price for an entry per market

C#
public  Price GetSalePrice(Entry entry, decimal quantity)
{
    var currentMarket = _currentMarketService.GetCurrentMarket();
    return StoreHelper.GetSalePrice(entry, quantity, currentMarket);
}

Example: Getting discounts per market

C#
public  Price GetDiscountPrice(Entry entry)
{
    var currentMarket = _currentMarketService.GetCurrentMarket();
    return StoreHelper.GetDiscountPrice(entry, string.Empty, string.Empty, currentMarket);
}

Last updated: Mar 31, 2014