Hi,
How to get the lineitems from the basket in commerce server 2009?
Regards
Subash
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Ramana NagineniPosted May 25, 2011, 11:26 AM
The following is one way to retreive, there are some other methods using WebService, Orders Runtime, or CS2009 API calls (used in order details web part) .
I recommend to post in Commerce Server forums http://social.msdn.microsoft.com/Forums/en-US/commserver2009/threads
OrderSiteAgent ordersAgent = new OrderSiteAgent("Your Site Name");
OrderManagementContext context = OrderManagementContext.Create(ordersAgent);
PurchaseOrderManager manager = context.PurchaseOrderManager;
DataSet searchableProperties = context.PurchaseOrderManager.GetSearchableProperties("en-US");
SearchClauseFactory factory = context.PurchaseOrderManager.GetSearchClauseFactory(searchableProperties, "PurchaseOrder");
SearchClause searchClause = factory.CreateClause(ExplicitComparisonOperator.Equal, "TrackingNumber", "122233"); //your search clause
Microsoft.CommerceServer.SearchOptions options = new Microsoft.CommerceServer.SearchOptions();
DataSet ds = context.PurchaseOrderManager.SearchPurchaseOrders(searchClause);
DataSet ds1 = context.PurchaseOrderManager.GetPurchaseOrderAsDataSet(new Guid(ds.Tables[0].Rows[0][0].ToString()));
DataTable dtLineItems = ds1.Tables["LineItems"];