Technical support This forum is closed.
Version 1.x > Technical support > COM_Products table cms.? View modes: 
User avatar
Member
Member
rahemeen - 5/17/2006 10:37:39 AM
   
COM_Products table cms.?
i sent 5,6 threads last 10days but not anyone is answered. any problem with support system.
plz it is urgent

as u suggested i imported my products using treenode.insert method but to add the same product in cart it should be imported to com_products table also. and how to import in this table let me know plz.

bcaz treenode("cms.product") inserts in content_product table what i should use treenode parameter to insert in com_products table.

plz reply this thread

very kind regards

User avatar
Member
Member
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