Data Retrieval in Commerce Server 2007
Seach Clause Factory : In search clause, we usually find a product using the Catalog Name, the Category Name, and the Search Clause. To do this we usually do the following :
CatalogItemsDataSet catItemDs = new CatalogItemsDataSet();
CatalogSearch catalogSearch = CommerceContext.Current.CatalogSystem.GetCatalogSearch();
CatalogSearch.CatalogNames = "TheCatalogName";
CatalogSearch.CategoryName = "TheCategoryName";
CatalogSearch.SearchOptions.ClassTypes = CatalogClassTypes.ProductClass;
// set the search creitera
CatalogSearch.SqlWhereClause = "Item1 = '" +value + "'";
// Here we specify the condition for which the search has to be done.
// returns CatalogItemsDataSet
catItemDs = catalogSearch.Search();
//to get the desired properties
Here we get the desired properties of the products.
The Second and the most simple way of getting the product out the catalog System is through specifying the ProductId, and the Catalog Name. We do this in the following manner :
Product p = cc.GetProduct(CatalogName, ProductId);
After this we can get the value of the properties of the products
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment