Importing (sub)categories from CSV file

Oct 2, 2009 at 10:31 AM


I've been trying to set up the templates categoryCSV.ImportMapping and productCSV.ImportMapping to import products and categories from a CSV file.
It works fine, except for the creation of subcategories.
In my CSV file the first column contains the parent categoryname, and the second column contains the categoryname.
The categoryCSV.ImportMapping contains these columns like this:


The category from [COL:2] is created, but it doesn't have a parent category. It appears to be created as a root category.
I've tried some things, like creating the parent categories in advance before importing the categories. But always the category from [COL:2] is created as a root category.
I also tried creating rows in the CSV file that just contain the root categories (copied ROW:1 to ROW:2), but these rows are imported as empty products and the categories do not contain child categories.

The import functions work great, the products are attached to the category from [COL:2], the zipped documents are linked to the right products so everything works great, except for importing parent and child categories.
In the productCSV.ImportMapping i've added the category like this:


Is it possible to create a parent->child structure for imported categories?


Oct 2, 2009 at 1:41 PM

Hi Wilfred,

In the category mapping have you specified the parent name column:

                <CategoryDesc />
                <Message />
                <ProductTemplate />
                <ListItemTemplate />
                <ListAltItemTemplate />


This if off the top of my head, but I think it's that you need to do.

Let me know if this works, if not I'll dig a little deeper to try and remember what the hell I did!!



Oct 2, 2009 at 8:33 PM


First off, wonderful product. Unbelievable number of professional features for a new product. Hopefully community picks up on it.

I'm am having the worst trouble getting even a simple CSV import to work. I hope it's not a DNN5 issue. I've tried using the default category and product import templates and also creating new ones based on XML export.

DNN 5.1.2
NB_Store v1.2

Category "Desktop" already exists. I select radio button "Import as New Products" and leave checkboxes unchecked.

The error is:

Index was outside the bounds of the array.
at NEvoWeb.Modules.NB_Store.ImportCSV.addParentCategoriesToTop(Int32 PortalID, String CSVdata, String RowDelimeter, String FieldDelimeter)
at NEvoWeb.Modules.NB_Store.ImportCSV.SplitCSVdata(Int32 PortalID, String CSVdata, String RowDelimeter, String FieldDelimeter)
at NEvoWeb.Modules.NB_Store.ImportCSV.ImportCSVProducts(PortalSettings PS, String ImportFile, Boolean UpdateExistingProductsFlg, Boolean CreateCategoriesFlg, String RowDelimeter, String FieldDelimeter)

The import file I tried:

Desktop;ABC123;Dell;Inspiron 600m;Makes Time Travel Possible;xml;1;200;{Unused};ImageName1.jpg
Desktop;AAA111;Fell;Bow tie pasta;Makes Food Eating Possible;xml;3;400;{Unused};ImageName3.jpg

Even an ultra simple one line file...



Also: in my testing I noticed that switching between basic text box and Rich Text editor views will sometimes jumble tags and pull tokens outside of tags.


Oct 2, 2009 at 9:49 PM

Nevermind. It works with NB_Store_02.00.01 Beta. Upgrading from NB_Store 1.2 to 2.0.1 in DNN4.9.0 to DNN5.1.2. went smoothly, though.

Oct 3, 2009 at 4:02 PM


Stange, I can;t think of any changes to the CSV import code between 1.2 and 2.0...may just want to keep an eye on this to make sure we've not got a bug in there somewhere!!

Also the switching between textbox and editor can have this effect, the editor wants to reformat things, so you either need to change the setting of the editor to not re-format or just use the textbox...I opt to just use the textbox, this way I know exactly what I'm getting.