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?
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.
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,