Skip to main content
CSV Import: Categories
A
Written by Anna Verbichenko
Updated over 6 months ago

A categories CSV file for import must have a name categories-xxxxxx.csv, where the part -xxxxxx can be anything you want, or can be omitted.

Examples of correct product CSV file names:

  • categories.csv;

  • catergories-13-01-01.csv;

  • categories-from-my-provider.csv

A categories CSV file must contain at least two fields:

  1. name - a category name;

  2. path - a path to the category.

Example of the simplest categories CSV file:

There are many more fields that you can include in your product CSV file. Below is a list of supported fields and their respective value types for category import.

Fields supported by X-Cart core

Field in CSV file

What this field describes

categoryId

Unique identifier of a category.

String

path*

Path to category. Serves as an identifier.
Example:

Toys >>> Science Toys

String

enabled

Is the category enabled?

Yes/No

showTitle

Option to show category title

Yes/No

position

Internal value of the category order. May not be negative. A smaller number means a higher position in the order.

Integer

memberships

Membership types, which members can see the category. Do not set it if you want to make the category visible to all customers. Otherwise, it will be visible to the users assigned to specified membership only.

String,
Multiple

image

For any image that needs to be imported, you need to specify the image location. This can be one of the following:

  • Image URL (can be local to the X-Cart server)

  • Path to the image on the server relative to the <XCART-DIRECTORY> folder; for example, images/category/image1.png

Note that import of images takes considerably less time if the images to be imported are stored locally on the server. It doesn't matter if image path is specified as URL or filepath — X-Cart will try to detect if the URL is local to the server. So, if you need to import a considerable number of images from URLs, you can speed up the process quite a bit simply by saving those images locally on the server inside <XCART-DIRECTORY>/images folder.

String

cleanURL

SEO friendly URL of the category page.

Example: toys

Clean URLs are imported according to the following rules:

  1. If the cleanURL field value doesn't exist in a .csv file the category Clean URL field stays unchanged.

  2. If the cleanURL field value is defined in a .csv file and this field is empty for a category at the moment of import the respective category property is created the category Clean URL gaining the value of the respective field from the .csv file.

  3. If the cleanURL field value is defined in a .csv file and this field is NOT empty (exists) for a category at the moment of import the respective category Clean URL value is substituted with the one from the .csv file if the field value doesn't conflict with any of the existing Clean URLs values. If the conflict exists the cleanURL field value is automatically modified by adding -1 to the end of the field value.

String

name*

Category name.

String,
Multilingual
Max. length: 255

description

Full description of the category.

String,
Multilingual,
HTML allowed

metaTags

Defines the content of <meta name="keywords" content="%value%"> meta tag

String,
Multilingual,
Max. length: 255

metaDesc

Defines the content of <meta name="description" content="%value%"> meta tag

String,
Multilingual

metaDescType

Defines meta description content type. Can be either A or C, where:

  • A stands for automatic mode when meta description will be generated from category description;

  • C stands for custom mode when meta desciption will be taken from metaDesc_* field in appropriate translation*;
    *this means that if the store is in English language, meta description will be taken from metaDesc_en field.

String,
Max. length: 1

metaTitle

Defines the content of <meta name="title" content="%value%"> meta tag

String,
Multilingual,
Max. length: 255

Fields added by the add-on GoSocial

Field in CSV file

What this field describes

useCustomOpenGraphMeta

Defines whether use custom Open Graph meta tags for this product or use default ones

Yes/No

openGraphMeta

If useCustomOpenGraphMeta is Yes, then defines custom Open Graph meta tags

String,
HTML allowed,
Scripting allowed

Fields added by the add-on Product Filter

Field in CSV file

What this field describes

productClasses

Defines the content of useClasses of Product Filters

String,
Max length: 1

useClasses

Defines Classes for product filter. Can be either N, A or D, where:

  • N stands for Do not show the filter;

  • A stands for All classes from this category;

  • D stands for choose classes (custom mode).

String,
Max. length: 1

* Required field.

** See CSV Field Notices for more info.

Tips:

  • If you are going to import data into X-Cart and do not wish to update certain X-Cart fields during the import process, you should not include these fields in your CSV file for import. Simply remove the respective column(s) from the file.

  • If necessary, import can be used to clear previously set field values for non-numeric fields. To clear a field value, in a CSV file to be imported specify the value of the field as “NULL”. After the import process is completed, the fields for which the value “NULL” has been imported will be cleared.

    This feature is supported by the following fields pertaining to categories:

    • memberships;

    • image;

    • banner;

    • productClasses (processed by the add-on Product Filter).

Related pages:

Did this answer your question?