Importing products

The store supports the Import of Products, categories and product images.

Tip: For large imports you may need to update the web.config to allow for the execution, in which case you need to change the httpRuntime section to something like this:

<httpRuntime useFullyQualifiedRedirectUrl="true" maxRequestLength="8192" requestLengthDiskThreshold="8192" executionTimeout="6000"/>

Import

  • Import products as existing products, this will search for a product with a matching product reference, if found it will update this product, if not found it will create a new product.
  • Import products as new products.
  • created categories for the products, if not selected all imported products will be created in a default "Imported" category.
  • Import Shipping Rates. If selected all current shipping rates will be removed. (Product level shipping weights and costs will be imported with the products)
  • Product images can be imported using a zip file. If the size of the zip file is large, depending on the portal and web.config settings the zip file may not upload.
  • Documents can be imported using a zip file. If the size of the zip file is large, depending on the portal and web.config settings the zip file may not upload.

Importing CSV file formats

You can import a CSV file by using the productCSV.ImportMapping and categoryCSV.ImportMapping templates (BackOffice>Utilities>Templates).

The example template that are installed with NB_Store, "categoryCSV.ImportMapping" and "productCSV.ImportMapping" refer to a simple CSV import.
The default mapping corresponses to a CSV file format of:
[COL:1],[COL:2],[COL:3],[COL:4],[COL:5],[COL:6],[COL:7],[COL:8],[COL:9],[COL:10]
CategoryName,ProductRef,Manufacturer,ProductName,Summary,XMLData(Custom Product Field),Weight,UnitCost,{Unused},ImageName

A default Field delimeter of comma is used ","
A default Row delimeter of carrage return, line feed is used "vbCrLf"
To change these delimeters you can use the "RowDelimeter.ImportMapping" and "FieldDelimeter.ImportMapping" settings, make sure you use html decode characters (e.g.: &#09; = horizontal tab; &#13;&#10; = vbCrLf)

About the ProductRef field
Each Product in the CSV file MUST have a ProductRef, products with a blank ProductRef will not be imported.

The ProductRef field is simply a unique field on the product table to identify the product to external systems. (Usually the ProductKey/ProductRef used by stock control systems). It's not required by NB_Store other than linking products on the import.

Because any import CSV file will not have a direct ProductID match with the products in the DB, it's impossible to use the primary key of the DB to link/update products. Therefore in order to link product data the ProductRef is used instead of the ProductID, hence the requirment to have a unique ProductRef field for each Product. If you are just importing new products, the ProductRef is still required, but in this case you can simply use a sequencial ProductRef number. However I'd advise you to use some kind of sensible ProductRef number, otherwise you'll not be able to update products unless to keep a note of what the ProductRef is.

If you have no external datasource or no requirement to update product then you don;t need to populate this field. However best practise would say that giving your product a ProductRef can help future proof your Product Database.


TIP: This easiest way to setup a CSV mapping is to create a product in the store with the format you require, export to xml, edit the xml and extract the product section for the "productCSV.importmapping" ( between the <P> nodes) and extract the category section for the "categoryCSV.importmapping" (between the <NB_Store_CategoriesInfo> node).
Then by editing it to place in the [COL:#] tokens in the correct place. (Careful this can get more complex than you may think).

Import of multiple language import:
The [LANG] token can be used to link the import language, or a column token can be used if multiple langauges are to be imported.
- Each category name must be different for each languauge.
- A column must be specified for the Product Lang node. ([LANG] can be used for the other Lang fields)
- Each product must have an entry for each language, the product ref must be the same for each language.

The categoryID is linked to the "CategoryName" column in the productCSV.ImportMapping.

The "replaceCSV.ImportMapping" template setting can be used to replace strings in the CSV file. By default this setting is not created during the NB_Store installation, so you will have to create it in "BackOffice>Utilities>Templates", if you require string replacements.

In should be created in the format:
<root>
<item col="1" str="" rpl="" substr="true"/>
<item col="*" str="" rpl="" substr="true"/>
</root>

col = the column for the replace to be active. if a "*" is used them all columns are active.
str = the string to be searched for.
rpl = the string to be used as the replacement.
substr = if true column with be searched for any substrings, if false the the whole column must match for a replacement to be made.

Last edited Oct 20, 2011 at 10:01 AM by robax, version 3

Comments

AndreYPB Sep 29, 2014 at 6:27 PM 
How should one setup categories for sub category products? MainCat->SubCat or MainCat,SubCat??

Andr1 Sep 12, 2014 at 5:51 AM 
Unidirectional relation of products would import as bidirectional: https://nbstore.codeplex.com/discussions/567190