Import Categories from a Flat File

With MIVA Merchant you can import product categories from a flat file — a plain–text file containing set types of data separated by a tab or text character. You can edit a file that you created by exporting categories from your store (like categories.dat) or create an entirely new file. This can be a very efficient way to create your entire category tree or to set up categories for a new product line you will offer.

Create the Flat File

Enter the category data in any text editor (not a word processor) or in a spreadsheet program that supports exporting files to comma- or tab-delimited text files. Enter the information about each category on a separate line.

If you are starting with a file you exported from your store earlier like categories.dat delete the top line of the file containing the field names in a header. If you leave it, it will be imported into your store as a new category.

MIVA Merchant imports four fields or pieces of information about each category:

Code
The unique string of characters by which the category is identified and referenced. For instance, your store might use codes like G-ELEC for electric guitars, or nativeCA for California Native Plants. The category code can be up to 50 characters long. Changing the category code would break any references to it, including references from products, and from other categories.
Name
A descriptive name, which will be seen by shoppers in your store. The category name can be up to 100 characters long. You can change the name, without affecting references to the category.
Active
A boolean, or yes/no, field specifying whether the category is active in your store (indicated by the number 1), or inactive (indicated by the number 0). Inactive categories are not displayed in the store. This field should only contain a 1 or 0.
Parent Category Code
The code of the category under which the current category is to be placed. For instance, a gardening store might list Wildflower Seeds, Vegetable Seeds, and Sunflower Seeds under the category Seeds. Seeds would be the parent category of the other three.

Note that a category must exist, before it can be referenced as the parent of another category.

Categories are imported into MIVA Merchant starting at the top of the flat file. When you create the file, insure any categories that are to be parents come before the categories that will will refer to them.

The above are the same four fields you will see when you export categories from your store to a flat file. Your flat file can include them in any order. You will have the opportunity to specify the meaning of each field. The file can also include additional fields for your own reference. These will be ignored during the import process.

Here is a simple example, showing the tab-delimited content of a flat file for creating four categories:

SEEDS   Seeds 1
SEEDS-WILD    Wildflower Seeds     1     SEEDS

SEEDS-VEG     Vegetable Seeds 1   SEEDS

SEEDS-SUN     Sunflower Seeds 1   SEEDS

Notice that the 3 categories that use SEEDS as a parent category come after the parent category in the flat file. The category SEEDS is a top-level category, so there is no entry in the parent category field.

Notice, also, that the fields are not necessarily aligned, vertically. A single tab character separates each field. When you are creating flat files, do not be concerned with the appearance of the data. Inserting additional tabs, to force fields into alignment, will bump their contents out of the intended fields in the database.

References to images, like the category tree image and category title image, cannot be imported via a flat file. Similarly, product references cannot be automatically included in imported categories. Both must be handled normally in MIVA Merchant after the categories have been imported.

Specify Import Settings

Data File

Upload the plain text flat file that contains your new or edited categories. Follow the same process as you would use for uploading images.

Delimiter

Specify how each data field in a record will be separated from the next. Tab-delimited flat files are common. You can use any character like a comma or a vertical line ("pipe") character: |. Keep in mind that any character used in any field will be interpreted as a break between fields if it is specified as a delimiter.

Existing Categories

Select how the categories from the flat file should be used with respect to those currently in your store.

Do Not Update Existing Categories
Where a category code already exists in the store, the import feature disregards any information associated with that code in the flat file. Imports all information for new categories described in the flat file.
Update Existing Categories
Where a category code already exists in the store it imports information associated with that code in the flat file, while leaving other aspects of the existing category intact, like title and tree image specifications. Imports all information for new categories described in the flat file.
Replace Existing Categories
Completely replaces all information for any categories you have included in the flat file. This does not delete any other categories from the store. That is, if there are 20 categories in your store, and you import a flat file with 6 categories — four of which contain replacement data for existing categories, and two of which are entirely new, the result will be 26 categories (six of which are defined exclusively by the information you have imported).
This clears image references for replaced categories, but does not delete the image files from the server.

Once you have specified the data file, delimiter, and how existing categories are to be handled, click Next.

Specify Field Associations

The data is now available on the server and ready to be imported. For each column in the table specify the field where that data should be used. For instance the first column may contain the category codes. For any extraneous columns those containing information beyond the four fields to be imported leave the header set at <Select One> and that data will be passed over during the import process.

When you are satisfied that each column is properly labeled click Import. The categories will be imported as specified and available for use in the store.