Hi,
How to get the lineitems from the basket in commerce server 2009?
Regards
Subash
Commerce server 2009-How to get the lineitems from the basket
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Ramana Nagineni2 reputationPosted May 25, 2011, 7:26 AM EDT
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"];