Hi.
BillingCurrency should always be populated for both exisiting users and anonymous. The Code listet below is from the CartHelper implementation. This code sample is from 7.5, but I do not think this implementation has changed appart from Market. The market feature was included in R3 (API) and fully functional from 7.5.
public Cart GetCart(string name, Guid customerId, MarketId marketId)
{
Cart cart = Cart.LoadCartsByCustomerAndName(customerId, name).SingleOrDefault<Cart>((Cart c) => c.MarketId == marketId) ?? this.CreateCart(name, customerId, marketId);
return cart;
}
private Cart CreateCart(string name, Guid customerId, MarketId marketId)
{
if (string.IsNullOrEmpty(name))
{
throw new ArgumentException("Name parameter can't be null or empty", "name");
}
if (customerId == Guid.Empty)
{
throw new ArgumentException("CustomerId parameter can't be null or empty", "customerId");
}
Cart currencyCode = (Cart)OrderContext.Current.ShoppingCartClassInfo.CreateInstance();
currencyCode.Name = name;
currencyCode.BillingCurrency = CommonSettingsManager.GetDefaultCurrency().CurrencyCode;
currencyCode.CustomerId = customerId;
currencyCode.MarketId = marketId;
return currencyCode;
}
Hi
I am currently working on a legacy system (EPiServer Commerce 1R2 - SP2), both CurrencyCode (from SiteContext.Current) and BillingCurrency (from CartHelper.Cart) have been used in the solution from different user controls.
I searched 1R3 SDK, it said CurrencyCode was deprecated.
My questions is if I want to format the currency in 1R2, which method should I use? Does BillingCurrency alway have value set for both anonymous user and eixsting customer?
Thanks