Developer forum

Forum » Ecommerce - Standard features » The price of the order does Not validate with the sum of the orderlines.

The price of the order does Not validate with the sum of the orderlines.

Alexandru Aliu
Reply

Hey guys,

We're working on a website with 9.17.5 which uses Live Integration. Suddenly we encountered this error message in the last step of the checkout .

"The price of the order does Not validate with the sum of the orderlines." This doesn't seem to come from any of our modules so I assume is something that comes from Dynamicweb. 

Can anyone explain to me which fields are involved in this verification ? When I manually sum up the prices withvat and  prices without vat they will match the orrder fields, but I guess that there are some roundings involved that make this fail

Also, is there a way to configure / disable this ? 

 

 

 


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Alexandru

On the order that you can find in the backend, there is log information - in that list you can find more information on the validation error:

"Order price does not validate in database. Order price is negative or zero ....." where you can see some calculations.

You can disable price validation using the setting /Globalsettings/Ecom/Order/DisablePriceValidation=true - the setting does not come with a UI so you have to set it directly.

You might have not saved some data when it comes back from ERP if you do something custom? Or you have other code that changes the price without using discount or price providers?

This is the check being run:

 

var sql = new CommandBuilder();
sql.Add("SELECT [OrderPriceBeforeFeesWithVAT], [OrderlinePrice], [PriceDifference] ");
sql.Add("FROM (");
sql.Add("    SELECT [OrderPriceBeforeFeesWithVAT], [OrderlinePrice], ABS([OrderPriceBeforeFeesWithVAT] - [OrderlinePrice]) AS [PriceDifference]");
sql.Add("    FROM [EcomOrders] WITH (NOLOCK)");
sql.Add("    INNER JOIN (");
sql.Add("        SELECT [OrderLineOrderID], SUM([OrderLinePriceWithVAT]) AS [OrderlinePrice]");
sql.Add("        FROM [EcomOrderLines] WITH (NOLOCK)");
sql.Add("        WHERE [OrderLineBOM] = 0");
sql.Add("        GROUP BY [OrderLineOrderID]) t1 ON OrderID = OrderLineOrderID");
sql.Add("    WHERE [OrderID] = {0}) t2 ", order.Id);
sql.Add("WHERE [PriceDifference] > 0.01; ");

Votes for this answer: 2
 
Alexandru Aliu
Reply
Thank you Nicolai, the DisablePriceValidation helped. The problem seem to come from the rounding differences in AX and DW. The [OrderLinePriceWithVAT] is set exactly how it comes from AX, but [OrderPriceBeforeFeesWithVAT] is calculated by Dynamicweb and in some cases the differences is bigger than 0.01
 
Original message by Nicolai Pedersen posted on 23/05/2024 16:29:22:

You can disable price validation using the setting /Globalsettings/Ecom/Order/DisablePriceValidation=true - the setting does not come with a UI so you have to set it directly.

 

 var sql = new CommandBuilder();
sql.Add("SELECT [OrderPriceBeforeFeesWithVAT], [OrderlinePrice], [PriceDifference] ");
sql.Add("FROM (");
sql.Add("    SELECT [OrderPriceBeforeFeesWithVAT], [OrderlinePrice], ABS([OrderPriceBeforeFeesWithVAT] - [OrderlinePrice]) AS [PriceDifference]");
sql.Add("    FROM [EcomOrders] WITH (NOLOCK)");
sql.Add("    INNER JOIN (");
sql.Add("        SELECT [OrderLineOrderID], SUM([OrderLinePriceWithVAT]) AS [OrderlinePrice]");
sql.Add("        FROM [EcomOrderLines] WITH (NOLOCK)");
sql.Add("        WHERE [OrderLineBOM] = 0");
sql.Add("        GROUP BY [OrderLineOrderID]) t1 ON OrderID = OrderLineOrderID");
sql.Add("    WHERE [OrderID] = {0}) t2 ", order.Id);
sql.Add("WHERE [PriceDifference] > 0.01; ");

 

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi Alexandru

Good find.

You can control how Dynamicweb will round its calculations - see "Calculation roundings" https://doc.dynamicweb.com/documentation-9/platform/advanced-settings/ecommerce-advanced-configuration#10445

BR Nicolai

 

You must be logged in to post in the forum