Hi Dw,
I have a big problem with the Integration Framework (Ax integration), which loads the cart from the ERP-system on "Dynamicweb.Notifications.eCommerce.Cart.Loaded" and this event happens in the first line marked with bold, but the Currency in the Context is first set in the second line marked with bold.
This result in this error: Attempt to aritmatic with two prices of different currency
As I see it, the right context should be loaded before the cart...
Friend Shared Sub LoadedPage(ByVal page As PageView)
Dynamicweb.eCommerce.Frontend.CatalogPublishing.CatchCatalogPublishing.CatchCatalog(page.ID, page)
Dynamicweb.eCommerce.Frontend.Cart.CartCatch.CatchCart(page.ID, page)
If Not Common.Functions.IsPageviewLocked(page) Then
If Base.ChkString(page.Area.Value("AreaEcomLanguageID")) <> String.Empty Or Base.ChkString(page.Area.Value("AreaEcomCurrencyID")) <> String.Empty Then
If Not Dynamicweb.eCommerce.Common.Context.LanguageSetByCustomer Then
Dynamicweb.eCommerce.Common.Context.Language = Dynamicweb.eCommerce.Common.Application.Language(Base.ChkString(page.Area.Value("AreaEcomLanguageID")))
End If
If Not Dynamicweb.eCommerce.Common.Context.CurrencySetByCustomer Then
Dynamicweb.eCommerce.Common.Context.Currency = Dynamicweb.eCommerce.Common.Application.Currency(Base.ChkString(page.Area.Value("AreaEcomCurrencyID")))
End If
If Not Dynamicweb.eCommerce.Common.Context.CountrySetByCustomer AndAlso Not String.IsNullOrEmpty(Base.ChkString(page.Area.Value("AreaEcomCountryCode"))) Then
Dynamicweb.eCommerce.Common.Context.Country = Dynamicweb.eCommerce.Common.Application.Country(Base.ChkString(page.Area.Value("AreaEcomCountryCode")))
End If
End If
'Added for displaying and "security" reasons
Dim changeCulture As Boolean = True
Dim cart As Orders.Order = Common.Context.Cart()
If cart IsNot Nothing Then
If cart.StepNum = 6 Or cart.Complete Then
changeCulture = False
End If
End If
If changeCulture Then
If Base.Request("LanguageID") <> String.Empty Then
Dynamicweb.eCommerce.Common.Context.LanguageSetByCustomer = True
Dynamicweb.eCommerce.Common.Context.Language = Dynamicweb.eCommerce.Common.Application.Language(Base.Request("LanguageID"))
End If
If Base.Request("CurrencyCode") <> String.Empty Then
Dynamicweb.eCommerce.Common.Context.CurrencySetByCustomer = True
Dynamicweb.eCommerce.Common.Context.Currency = Dynamicweb.eCommerce.Common.Application.Currency(Base.Request("CurrencyCode"))
If Common.Context.Cart IsNot Nothing AndAlso Common.Context.Cart.OrderLines IsNot Nothing Then
Common.Context.Cart.OrderLines.RemoveDiscounts()
Common.Context.Cart.OrderLines.RemoveTaxes()
Common.Context.CartDiscountsAndTaxesAreHandled = False
End If
End If
If Base.Request("CountryCode") <> String.Empty Then
Dynamicweb.eCommerce.Common.Context.CountrySetByCustomer = True
Dynamicweb.eCommerce.Common.Context.Country = Dynamicweb.eCommerce.Common.Application.Country(Base.Request("CountryCode"))
End If
End If
End If
End Sub
Best regards, Anders