Technical support This forum is closed.
Version 1.x > Technical support > Import products and orders .xls file to CMS database View modes: 
User avatar
Member
Member
rahemeen - 5/4/2006 11:10:54 AM
   
Import products and orders .xls file to CMS database
First of all i appreciate the work done. i am using Kentico demo version and i am facing one problem. my client maintains its all transactions in GraitPlains software and he will provide us .xls (Excel File) file of products and orders time by time and the site should have a feature to import this .xls file into Kentico CMS database and it should replicate in E-Catalog and Orders List.

Hence, i gone through with Kentico Import Wizard but i need solution such that client will have a form where he will upload .xls file and a button click and the file data should be imported in the Kentico CMS Database in appropriate tables.

And i read you are recommending in your Kentico CMS Developer's Guide to create our own .Net Programme using Kentico API to import the database. so, i need your help in this regard. plz send me if any such script or programme will be so nice of you. and any suggestions in this regard will be highly thankful.

Plz reply as earliest as possible.

Thanx

very kind regards

User avatar
Guest
admin - 5/5/2006 8:26:14 AM
   
Re: Import products and orders .xls file to CMS database
Hello,

Thank you for your message. You basically need to create your own page that you can make a part of the Tools section of CMS Desk (see Developer's Guide -> Extending modules -> Creating Custom Modules).

You will need to use Kentico CMS API as you wrote. The pattern for importing/updating documents is:

1) Read a record from imported file.
2) Check if a record of the same identifier is stored in Kentico CMS.
3) If it exists, retrieve the document using TreeProvider.SelectSingleNode, set its properties using TreeNode.SetValue and save the values using TreeNode.Update.
4) If it doesn't exist, create a new TreeNode document of the appropriate type (class name parameter in constructor), set the values using TreeNode.SetValue and call TreeNode.Insert.
5) You may also add a mechanism that will delete all products that are no longer present in the source file (TreeNode.Delete).

Please let me know if you need any specific information.

Best Regards,

User avatar
Member
Member
rahemeen - 5/8/2006 9:55:13 AM
   
Re: Import products and orders .xls file to CMS database
thanx a lot for your support.
can you plz let me know which kentico API i should use for importing .xls file into sql server and if you have and reference or code snippet of .net will be so kind of you. bcaz i am new to .net and need your help to import .xls data into Kentico CMS products table.

i have 5 columns in excel sheet
--------------------------------------------------------------------
MainCat SubCat ProductID ProductName UOM
--------------------------------------------------------------------
CAT1 SubCAT1 9458 Bags PCS


here i want to know where should i place these fields in kentico database so that i see these in products page as main and sub category as menu and related products in content side.

plz help me out of this and any reference or code help will be much appreciated.

Thanx a lot

waiting for reply

very kind regards

User avatar
Guest
admin - 5/8/2006 12:09:33 PM
   
Re: Import products and orders .xls file to CMS database
Hello,

you will need to use an existing Product table in Kentico CMS or you can define a new table when you create a new document template in CMS Desk -> Development -> Document templates.

Then, you will need to use Kentico CMS API, specifically the Kentico.CMS.TreeEngine library. You can find code samples for basic operation in Kentico CMS Developer's Guide -> Using Kentico CMS API.

Best Regards,

User avatar
Member
Member
rahemeen - 5/8/2006 6:56:10 PM
   
Search Page Help
thanx for your help
how can i create search criteria where i will have two options
1.search by partnumber
2.search by partname

iwill have option button and i will opt any one on that basis it has to return the results
how kentico cms can implement this future plz reply in this regard

very kind regards

User avatar
Member
Member
rahemeen - 5/8/2006 6:57:47 PM
   
Product page should have paginations system
dear administrator plz help me how can i place page numbers on product page if products are more and i will to restrict products 10 per page and need to have all pages links in the bottom

plz reply thanx in advance
very kind regards

User avatar
Guest
admin - 5/9/2006 1:10:56 PM
   
Re: Product page should have paginations system
Hello,

paging is supported only for the CMSDataGrid control. If you need to use paging for some other control, you will need to implement custom paging like in this article: http://aspnet.4guysfromrolla.com/articles/091003-1.2.aspx

Best Regards,

User avatar
Guest
admin - 5/9/2006 1:07:35 PM
   
Re: Search Page Help
Hello,

you can use some of the Kentico CMS controls, such as CMSDataGrid or CMSDataList and dynamically set their SelectNodesWhere condition to e.g.

" partnumber LIKE N'%" + txtPartNumber.Text.Replace("'", "''") + "%' "

Best Regards,

User avatar
Member
Member
rahemeen - 5/10/2006 9:31:33 AM
   
How to import 15000 products in Kentico CMS
thanx dear administrator for support
just help me out in this problem.
i have around 15000 products having different main category and subcategory
and i created product page in Kentico CMS and added few main category as menuitem and few subcategory as submenuitem from Kentico CMSDesk and added few products also in each category but situation is i have around 15000 products and i have all information in excel file. i cannot go on adding 15000 products from cmsdesk. so i want all products imported in Kentico CMS Database once. and it should be placed accordingly in related tables so that it automatically create mainmenu,submenu and products.

as i checked the kentico cms database when we create menu and product it effect 3 tables
1. CONTENT_MenuItem
2. CONTENT_Product
3. CMS_Tree

Importing data into CONTENT_MenuItem and CONTENT_Product is easier but how to import data in CMS_Tree table so that it created proper menu and submenu and place related products in menu.

plz reply soon with detailed information abt these tables and how to import once all data
very kind regards

User avatar
Member
Member
Martin_Kentico - 5/11/2006 8:58:03 AM
   
Re: How to import 15000 products in Kentico CMS
Hello,

You shouldn't import the data directly into the database, because it would (almost sure) cause system inconsistency.

Instead, you should use the Kentico.CMS.TreeEngine library to import the data


First prepare the document structure of your product (Document templates) within CMSDesk Devlopment section

Then you should use the scheme like this (in is not actual code, just the lead how you should do it, you will need to edit extend it by your needs):


// Load the Excel file

for each product record in the excel file // You will need to process the excel file structure
{
// Create a document record in CMS_Tree and CONTENT_Product tables by using Kentico.CMS.TreeEngine by using following code:

TreeNode newNode = new TreeNode("CMS.Product"); // Or any other className (document template code name) you have defined for your product

newNode.SetValue("SomeColumn", value); // Set all the values you need by calling this method for each column you need to set (you shouldn't set the identity columns)

newNode.Insert(categoryAliasPath, TreePathTypeEnum.AliasPath); // With categoryAliasPath set to the proper category node (probably MenuItem in your case) where you need to import the product
}


Each cycle iteration will insert one product record into your database along with the proper and valid tree structure records. The TreeNode class instance will hold the joined record from CMS_Tree and you document type table and provides you all the consistency you need.

Hope this would help a little, if you need any further help with that, please let us know

Best Regards

User avatar
Member
Member
rahemeen - 5/13/2006 10:00:49 AM
   
Re: How to import 15000 products in Kentico CMS
sorry dear administrator but i wrote one program in vb6 which reads products from excel sheet and imports into Kentico database and tried to trace all database tables where your products and menuitems are storing. and accordingly i imported and import works successfully at one click but just as you said menu is ok main category and sub category and in subcategory it is showing all products in the menu of cmsdesk but not showing product page and in cmsdesk also when u go to subcategory and click on a product it is not showing page to edit there also.

just see which tables i imported

1. CONTENT_MenuItem
2. CONTENT_Products
3. CMS_Tree

in these 3 tables i imported data as kentico table structure needs. but still iam unable to see the products listed on the page

so, plz guide me what precautions or where i should more import the data so that i see the products listed on the page.

plz reply

thanx in advance
very kind regards

User avatar
Member
Member
rahemeen - 5/13/2006 10:06:38 AM
   
CMS DataGrid and link to Add to Cart or CheckBox
dear admin

as i asked b4 for pagination system and u suggested to use cmsdatagrid and it is ok for pagination. another prob. is when i use cmsdatalist it is showing each product a link Add to cart.
but when i use cmsdatagrid it is not showing that link. and my client needs a check box beside each product informatin and he will check that box and when he checks products as many as he wants to order he will click Add to cart button and then all products checked should be displayed in order page.

how to do this using cmsdatagrid plz guid me

thanx a lot for your support
very kind regards

User avatar
Member
Member
Martin_Kentico - 5/19/2006 3:30:07 PM
   
Re: CMS DataGrid and link to Add to Cart or CheckBox
Hello,

I'm very sorry about the delay.

When you need to implement such an extended feature, you need to create more complex product transformation and set the transformation to use in you DataGrid (or any other control) by setting TransformationName="cms.product.yourtransformation" or SelectedTransformationName="cms.product.yourtransformation" in the control. You should place the controls into the transformation.

You can also use the regular transformation, handle the DataGrid ItemDataBound event and add the extended control dynamically instead of the previous solution.

You should find all the information you need to know about the document transformations in the Kentico CMS Documentation (especially Developers Guide, Tutorial)


Then you need to implement the postback handler in your page, that will go through all the DataGrid items, finds the checkboxes (or any other controls you need) and calls the proper URL of the shopping Cart.

Unfortunately, there is currently no support how to add several kinds of product within one cart entry, so you will need to edit the ShoppingCart/ShoppingCart.aspx page to implement this feature or use similar code that the page uses to insert the products into the cart without entering the ShoppingCart page.


If you need any further help with that, please let me know

Best Regards