Developer forum

Forum » Development » Attempt to aritmatic with two prices of different currency

Attempt to aritmatic with two prices of different currency

Anders Ebdrup
Reply

Hi Dw,

 

I have a shop (v8.3.0.2) and when switching from one website to another with items in my cart, then I get this error:

 

 

Attempt to aritmatic with two prices of different currency

 

[PriceInfoCurrencyException: Attempt to aritmatic with two prices of different currency]
   Dynamicweb.eCommerce.Prices.PriceInfo.Add(IPriceInfo info) +294
   Dynamicweb.eCommerce.Prices.PriceInfo.Add(IWithPrice priceholder) +25
   Dynamicweb.eCommerce.Orders.OrderLineCollection.get_Price() +184
   Dynamicweb.eCommerce.Orders.Order.get_PriceBeforeFees() +29
   Dynamicweb.eCommerce.Orders.Order.FindPaymentFee(FeeCollection FeeCollection) +115
   Dynamicweb.eCommerce.Orders.Order.get_PaymentFee() +199
   Dynamicweb.eCommerce.Orders.Order.SaveOrder(String IDStr, Boolean saveOldVersion) +573
   Dynamicweb.eCommerce.Orders.Order.Save(String IDStr, Boolean saveOldVersion) +49
   Dynamicweb.eCommerce.Frontend.Cart.CartPageTemplateExtender.ExtendTemplate(Template Template) +46
   Dynamicweb.Frontend.PageView.RenderPageTemplateExtenders(Template Template) +538
   Dynamicweb.Frontend.PageView.SetPageTemplateValues() +12533
   Dynamicweb.Frontend.PageView.Output() +708
   Dynamicweb.Frontend.PageviewControl.ParseControls() +55
   Dynamicweb.Frontend.PageviewControl.OnInit(EventArgs e) +86
   System.Web.UI.Control.InitRecursive(Control namingContainer) +381
   System.Web.UI.Control.AddedControl(Control control, Int32 index) +204
   System.Web.UI.ControlCollection.Add(Control child) +157
   Dynamicweb.Default.Page_Load(Object sender, EventArgs e) in d:\Work\Repositories\Dynamicweb\Main\Source\Application\Default.aspx.cs:10
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +85
   System.Web.UI.Control.OnLoad(EventArgs e) +74
   System.Web.UI.Control.LoadRecursive() +120
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2847

As extra information the shop is integrated to Ax.

 

Best regards, Anders


Replies

 
Nicolai Høeg Pedersen
Reply

Its a feature!!

 

Will look into it - it is of course because the 2 websites have different currencies. You can make the same currency on both, or use different domains on them.

 

But we will register it as a bug and get on with it.

 

BR Nicolai

 
Anders Ebdrup
Reply

 

Original message by Nicolai Høeg Pedersen posted on 18/09/2013, 12:46:

Its a feature!!

 

Will look into it - it is of course because the 2 websites have different currencies. You can make the same currency on both, or use different domains on them.

 

But we will register it as a bug and get on with it.

 

BR Nicolai

Nice feature :-)

 

When do you expect this "feature" fixed as none of the two workarounds is possible for my client?

 

Best regards, Anders

 
Merethe Nielsen
Reply

Hi

 

I´m sorry but we can not reproduce it on our test sites with the released 8.2.0.3 and I have tried to change currencycode in URL from DKK to USD which usually provokes this error and tried to switch between 2 pages (DK and US) without any errors:
http://screencast.com/t/t7NvBQhG5c3

 

 

Can you give us a copy of the site or give us a video/steps to help us investigate this?

 
Anders Ebdrup
Reply

Hi Merete

 

Thanks for the reply. I think the problem is related to the Ax-integration.

 

I have attached a screen dump where you can see that even though I have changed the currency code to "DKK" in the url (the yellow marker in the bottom) the currencycode on the order is still "EUR".

 

The event happens on: "Dynamicweb.Notifications.eCommerce.Cart.Loaded", so the question is when do you change the currencycode on the order??

 

Best regards, Anders

Capture.PNG
 
Merethe Nielsen
Reply

Hi again

 

I´ll check this with one of our developers.

 

Kind regards,

Merethe Nielsen, QA

 
Jonas Dam
Reply

Hi Anders,

I have been looking at the problem, but like Merethe, I cannot reproduce it on 8.3 without any notification subscribers.

Have you seen the same problem without the AX integration?

Can you provide us with a copy of your database, files folder and bin folder, so that we can try to reproduce the problem?

 

Thanks,

Jonas Dam

 
Anders Ebdrup
Reply

Hi Jonas

 

I have been looking into this problem again, and it seems to be something with the order of the different events.

The currency of the cart is changed by this

		Public Overrides Sub ExtendTemplate(ByVal Template As Template)
			Dim EcomCart As Dynamicweb.eCommerce.Orders.Order = Dynamicweb.eCommerce.Common.Context.Cart

            If Not EcomCart Is Nothing Then
                If eCommerce.Cart.Frontend.CheckContextCurrency(EcomCart) Then
                    EcomCart.Save()
                End If

                Dim ecomRenderer As New Dynamicweb.eCommerce.Frontend.Renderer(PageView)
                ecomRenderer.RenderOrder(EcomCart, Template)
            End If
		End Sub

In the CartPageTemplateExtender, but the cart is not reloaded from the AX even though the currency is changed.

At the same time the currency is only changed for the cart not the cart lines which seems to be the problem.

 

You have already the database so if you still need the bin-folder and the files folder then let me know.

 

Best regards, Anders

 

You must be logged in to post in the forum