Importing Categories

Learn how to create and update categories using the regular import facilities.

Olga Tereshina avatar
Written by Olga Tereshina
Updated over a week ago

Importing categories is helpful if you want to add categories to the store or edit them in bulk.

For data import/export, X-Cart uses CSV files. Such files can be edited using any popular spreadsheet editor like MS Excel or LibreOffice Calc.

You can use two different types of CSV files to import categories:

  • categories.csv - allows creating new categories and updating existing categories details;

  • products.csv - allows assigning products to existing categories and creating new categories while creating products to them; does not allow maintaining category details.

If you have a CSV file exported from another source (a list from a supplier, an export file from some 3rd party store, etc.), you need to rebuild it to X-Cart's format. If the structure doesn't match, the import fails.

Learn more about the X-Cart Categories CSV file format here.

Managing Categories via the Categories.CSV File

A categories.csv file allows creating and updating categories, including all category details. Below is how a sample categories.csv file may look:

You can change the category ID, path, image, description, etc., or even delete some category details if required โ€” a complete list of fields supported by a Categories.CSV file you can find here.

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

If necessary, you can use import to clear previously set field values for non-numeric fields. To delete a field value, in a CSV file to be imported, specify the value of the field as "NULL." As a result, the information related to the fields with the "NULL" values will disappear from your store.

You can use this feature for the following fields in the categories.csv file:

  • memberships;

  • image;

  • banner;

  • productClasses.

For any other fields, e.g., description, you can put the space HTML character ( ) to clear the value and update the database records.

Assigning Products to Categories via the Products.CSV File

The products.csv file is a general file for importing all product-related info. You can use this file to create new categories and assign products to them. Since products.csv contains all product-related data, the file structure is rather complex.

The field that controls the category-related data is categories. You can use this field to specify the category a product belongs to. Also, you can use the inCategoriesPosition field to define the products' order within a category.

Below is how a products.csv file may look if it contains only the categories-related data.

If you want to assign a product to a different category, change the value of the "categories" field for this product. If you specify a non-existing category for a product to be updated, this category will be created in your store during import.

If you want to cancel a product assignment to a category, set a "NULL" value for the "categories" field.

Related pages:

Did this answer your question?