Developer forum

Forum » Ecommerce - Standard features » Save Order problem. Invalid state

Save Order problem. Invalid state

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

We have a solution where we get a lot of the following errors:

2021-03-25 11:57:02.5228|ERROR|Ecom/Order|Save Order problem. Invalid state, saving: CART40409

We see 4-5 of these errors a day. The result in most cases is that the cart is empties on checkout instead of converting it into an order.

Anybody have the same or similar issue? The solution is running on DW 9.8.8.

Thank you,

Adrian


Replies

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

Hi Adrian,

The error occurs when trying to save a cart which has been marked as complete (invalid state) OR if there is a mismatch between the modified timestamp of the order and the data in the database (data in database is the most recent).

  1. Can you try to find one of the carts in Ecommerce > Carts, go to details and check the log?
    1. Is there an entry with a message like "OrderModified date mismatch with database" and some timestamps? Please paste the entire log entry here.
  2. Can you find a stack trace for this error?
    1. Check Settings > System > Event viewer (filter by category: Application/Order)
    2. Check Logs > Ecom > Order
  3. Can you tell me which checkout handler you are using?
  4. Does the solution have live integration enabled?

Best regards,
Morten 

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Morten,

Thank you for the suggestion.

I will check the log and add the necessary information.

Thank you,

Adrian

 
Jose Caudevilla
Reply

Hi,

 

I have a similar issue. It happens sometimes and the error appears in a custom Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.Loaded notification.

Here is the error message:

The code line that generates this error is the follows:

            Dynamicweb.Ecommerce.Common.Context.SetCart(loadedCart.Cart);

On the other hard, the order contains the next data:

 

Thanks,

Jose

 

 

 

 
Dynamicweb Employee
Thet Nong Phu
Reply

Hi Sir,

I have similar issue about mismatch.

In CheckoutHandlers implementation Redirect(), I need to modify some values on Order and OrderLines.
Some order are caught an exception "Order OrderModified date mismatch with database" and cannot proceed setting values.
 
Could someone provide suggestion?
 
Application 9.8.6
Order is completed with Server call.
Error occur client callback to show Receipt and modify some values.

 

Thanks

Phu

 
Nicolai Pedersen
Reply

Use CheckoutDoneOrderIsComplete notification instead.

There are a number of issues with modifying the order in these steps. Since it is a payment step, Dynamicweb needs to ensure that order values do not change from payment begins untill payment has completed. Otherwise there is a risk that the ordertotal can be changed and payment mismatches.

 
Dynamicweb Employee
Thet Nong Phu
Reply

Hi Nicolai,

Thanks for your suggestion. I will check.

We are also facing another issue related to ordermodified date mismatch in live site in one customer order. Users search the product and added the item into the cart. order modified date mismatch issue happened and the line added, and modified notification subscribers were not called and price become 0 for that item (we are using custom pricing). Kindly refer to the image below.

Since this is just using cartcmd command, we are not sure why this order date mismatch issue happened. it only happens sometimes but this is raised as critical issue by the user. Appreciate to get your suggestion. Thank you in advance.

 

Thanks

Phu

 
Nicolai Pedersen
Reply

I wonder about all those order saved commands. Can you show all the custom code you have that would call order.save?

 
Dynamicweb Employee
Thet Nong Phu
Reply

Dear Nicolia,

Sorry. We don't have order save in templates like mini cart or cart pages or other front end pages. We only have order save in notification subscribers which is difficult to pass as it will require the whole project.

Thanks
Phu

 
 
Nicolai Pedersen
Reply

Alright - but I guess those notifications is the problem... You can just cut and paste them here.

 

You must be logged in to post in the forum