Commerce serer 2007 exposes different API for different purpose but the main disadvantage is that it doesn’t give flexibility to develop ecommerce applications for multiple devices (channels – mobiles, kiosk, etc). To overcome this problem Microsoft has wrapped a new API model (multi-channel foundation) on top on existing commerce server runtime API. It exposes a set of models, known as commerce entities (such as products and baskets – similar to .NET entities) to represent the conceptual view of e-commerce. To know more about this, you can refer to following urls.
http://microsoftblog.co.in/commerceserver/how-i-learnt-commerce-server-foundation/
http://msdn.microsoft.com/en-us/library/dd327929.aspx
In this post, I am trying to fetch products under a category using commerce server foundation. The method takes three parameters – catalog name, category name and user id and returns all products in the form of datatable.
| public DataTable GetChildProducts(string CatalogName, string parentCategory, string userId) { CommerceRequestContext requestContext = new CommerceRequestContext(); requestContext.Channel = "Default"; requestContext.UserId = userId; requestContext.RequestId = Guid.NewGuid().ToString(); requestContext.UserLocale = "en-US"; requestContext.UserUILocale = "en-US"; // Create a Operation Service Agent // Define DataTable // Query for a Product // Add more properties here…. // Add Related Query Operation for Canonical Categories CommerceResponse response = operationService.ProcessRequest(requestContext , queryBuilder.ToRequest()); // Handle Responses |
If you like this post, please click on our sponsor advertisement.
