CartValidate - Calculate Totals - Save to database

Vote:
 

Hi, 

I'm hoping this is as an easy one because it's so fundamental. How do the totals that are calculated in CartValidateWorkFlow -> CalculateTotalsActivity get saved to the database? 

We're on the latest version of EPiServer Commerce (8.15) and I'm just trying some initial Add to Cart, Get Cart routines. I'm using the standard CartHelper calls for the Add to Cart functionality and this is working fine, lineitems are added with the correct prices and the corresponding OrderGroup and OrderForms are created. The Order Totals are empty however as I understand this is expected. It is the responsiblity of the CartValidate Workflow to populate these values. However, when I run the CartValidate these totals remain untouched. There are no discounts or promotions that should be affecting this.

I ended up pulling the latest Mediachase.Commerce.Workflows code from the EPiServer8 Commerce Sample package and debugged it. Turns out in CalculateTotalsActivity -> CalculateTotals the totals are getting populated correctly on the OrderGroup and OrderForm objects but nothing seems to happen with them. I added my own order.AcceptChanges() to see what happens and everything works as expected. 

Since this is run-of-the-mill shipped code I shouldn't have do this. I must be missing something? How do these values get commited back to the DB? 

Cheers,

#131769
Aug 05, 2015 9:51
Vote:
 

The workflow is supposed to do the calculation in the memory, you should be the one who explicitly call the Cart.AcceptChanges() or PurchaseOrder.AcceptChanges() to persist data into database.

Regards,

/Q

#131795
Aug 05, 2015 12:56
Vote:
 

Nice and easy!  

#131813
Aug 06, 2015 3:14
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.