Developer forum

Forum » Development » Value either too large or small for decimal error when calculating price

Value either too large or small for decimal error when calculating price

Oscar Romin
Oscar Romin
Reply

Hello, I'm having a bit of a weird and major issue. This post is a bit of a hail mary since many factors regarding this are unbeknownst to me and the issue originated several months ago and the project has been in hiatus since then too, so I don't think I can answer too many questions you will have about this issue unfortunately. 

But the issue is this: ever since we imported *something* (probably some price information or a malfunctioning product) from our ERP-system a few months ago, products began having price calculation issues. Basically we got this error, which basically says that the value is too big or too small for a decimal (sorry for the swedish error-message).

System.OverflowException: Värdet var antingen för stort eller för litet för Decimal. vid System.Decimal..ctor(Double value) vid Dynamicweb.Ecommerce.Prices.PriceInfo.ConvertToPIP(Double amount) vid Dynamicweb.Ecommerce.Frontend.Renderer.RenderPriceInfo(IPriceInfo price, Template template, String tagName) vid Dynamicweb.Ecommerce.Frontend.Renderer.RenderProduct(Product product, Boolean extendedProperties, Template template, Int32 loopCounter, Boolean renderRelated, String productUrl, Int32 quantity, Int32 wishListId, Boolean renderPublicList, Boolean isRecursiveCall, Lazy`1 categoryFieldSorting, Int32 orderLineOfProductCount) vid Dynamicweb.Ecommerce.Frontend.Renderer.RenderProducts(ProductCollection products, Template parentTemplate, String loopName, Int32 loopCounter, Boolean renderRelatedProducts, Boolean renderRelatedLists, Boolean isRecursive) vid Dynamicweb.Ecommerce.Frontend.Renderer.RenderProducts(ProductCollection products, Template parentTemplate) vid Dynamicweb.Ecommerce.Frontend.Renderer.RenderProducts(ProductCollection products) vid Dynamicweb.Ecommerce.Frontend.Frontend.ListProducts(ProductCollection products, String groupsIdent, Boolean hasBeenSorted) vid Dynamicweb.Ecommerce.Frontend.Frontend.GetProductsFromIndexQuery()

So if we render the price of any product at all on a page, the page crashes and we get this error. This also includes rendering the price via typing @product.TemplateTags() in a template. This is very annoying and prevents any debugging of course. If we dont render the price at all though, or if we set the price to zero in DW-admin, then the product will render as usual. So that's what we have done to sidestep this issue for now, but it will of course have to be handed with unless we want to change into a charitable company. ;) 

We thought before that this might have had something to do with the LiveIntegration, since it tried fetching live prices for users and the ERP-system might have gotten an error of some kind (which they often got), which then could have resulted in this error on our end, but since then we have disabled the LiveIntegration for the project and the error persists. 

Does anyone know anything at all or have any ideas that can be helpful? DW 9.4.14


Replies

 
Nicolai Pedersen
Reply

Hi Oscar

You can change exceptions to english for your application - try to google that - that would help you alot.

To find the error, you can attach a debugger and get some debugging symbols from the nuget feed or from the symbols download. That would give you an idea on what data is wrong.

If that does not give you pointers, feel free to contact the support - they will probably need a copy of the solution in order to locate your data error.

BR Nicolai

 
Oscar Romin
Oscar Romin
Reply
This post has been marked as an answer

It took some debugging if DW-dlls, but I found out what the problem was. It turns out that our ERP-system sent us corrupted EcomCurrencies, and when DW tried doing calculations with these something behind the scenes broke. So I made the currency for Swedish Krona into Default, and set its Rate-value to 1 and set its Payment code-value. They were all empty. See attached image. 

And also, the languageversion of DW controls which language the error displays in, so if I went in to the english version of our site then the error was in english. The more you know. 

DecimalErrorSolution.jpg
Votes for this answer: 1
 
Nicolai Pedersen
Reply

Great, glad you found it and thanks for sharing.

Usually the rate should be 100 as that is the base for currencies.

BR Nicolai

 

You must be logged in to post in the forum