Martin_Kentico
-
5/19/2006 2:44:30 PM
Re: COM_Products table cms.?
Hello,
I'm very sorry for the delay.
You can define the Commerce module product through the Kentico CMS API just the similar way how to deal with other document classes except the COM_Product records are provided by Kentico.Commerce.Product class.
Here is a simple code how you can add the product to the existing document:
TreeNode node = TreeProvider.SelectSingleNode("/Products/Product1", TreePathTypeEnum.AliasPath);
// Insert new product. Kentico.Commerce.Product product = new Kentico.Commerce.Product(); product.SetValue( "ProductName", "Some product name" ); // Name you desire product.SetValue( "ProductPrice", 10 ); // Price you desire product.SetValue( "ProductCode", "Some product code" ); // Code you desire product.SetValue( "ProductVatRate", 5 ); // VAT rate for the product product.SetValue( "ProductIsActive", true ); // If product is active // Insert product. product.Insert(); // Update document to bind to the product. node.SetValue( "ComProductID", product.GetValue( "ProductID" ) ); node.Update(); You can find some more code to work with the COM_Product records within cmsdesk/Content/Products.aspx page code
Best regards
|