Posted on 23/05/2024 16:29:22
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; ");