Commerce Server with Sitecore - how to update orders status

492 views Asked by At

May I ask how to update orders status with Sitecore Commerce 8 powered by Commerce Server. Or in sitecore 7.2 if possible.

Based on the class Sitecore.Commerce.Connect.CommerceServer.Orders.Models.CommerceOrder class, we tried to save StatusCode as "InProcess" but it was not updated.

CartServiceProvider provider = new CartServiceProvider();  
var orderRequest = new SubmitVisitorOrderRequest(buyCart);  
var orderResult = orderService.SubmitVisitorOrder(orderRequest);  
var order = orderResult.Order as CommerceOrder;  
order.StatusCode =  "InProcess";  
provider.SaveCart(new SaveCartRequest(order));
1

There are 1 answers

0
user3363554 On

We have tried the code below but got an error. https://social.msdn.microsoft.com/Forums/en-US/a4e74c33-cf4f-4a1b-843c-acf2514db3f2/how-to-update-purchase-order-status?forum=commserver2009#44ff5a5e-b6af-4b82-aebe-1c53beff9f5c

We modified the code to update status as admin OrderSiteAgent orderAgent = new OrderSiteAgent("website", true, "");

Error : on line OrderManagementContext context = OrderManagementContext.Create(ordersAgent); There was a problem reading the site resources from the Commerce Server administration database for the site 'website'. Please check that resources exist for the site and that the process has permission to access the database. The InnerException contains more details.