X-Cart:Import-Export Guide

From X-Cart 4 Classic
Jump to: navigation, search

Import/Export procedures in X-Cart

X-Cart 4.4.x features exporting and importing literally all types of data used in X-Cart. The export and import procedures facilitate the updates of your store data and ensure the consistent transfer of the data when upgrading the store or moving it to a new location.

The basics of the export procedures are available in the Exporting Data section; for the import procedures - in the Importing Data section.

The detailed information on X-Cart's import and export features can be found in the Import/Export Guide

Roles in Import/Export management

If you are an X-Cart GOLD or GOLD PLUS administrator/provider, you can import and export:

  • Config data
  • States
  • Users
  • Categories (including international category descriptions)
  • Products (including international product descriptions, featured products and product links)
  • Destination zones
  • Taxes (including tax rates)
  • Shipping rates
  • Orders (export only, including order items)
  • Other types of data (depending on the set of enabled modules and add-ons).

If you are an X-Cart PLATINUM or PRO administrator, you can import or export all types of data used in X-Cart:

  • Config data
  • States
  • Users
  • Categories (including international category descriptions)
  • Products (including international product descriptions, featured products and product links)
  • Destination zones
  • Taxes (including tax rates)
  • Shipping rates
  • Orders (export only, including order items)
  • Other types of data (depending on the set of enabled modules and add-ons).
Note: When exporting products, destination zones, tax rates, shipping rates or orders, you can export all data or just the data of a specific provider. Also, please note that these types of data can be imported for different providers only (i.e. you will be expected to specify the name of the provider you are importing the data for before starting the import).

If you are an X-Cart PLATINUM or PRO provider, you can import or export:

  • Your products (including international product descriptions and product links)
  • Your destination zones
  • Your tax rates
  • Your shipping rates
  • Your orders (export only, including order items)
  • Other types of data according to your access privileges (depending on the set of enabled modules and add-ons).

Exporting Data

X-Cart 4.4or above

You can export the data from your X-Cart store in the 'Export data' section of your store's admin area.

To access this section:

  1. Go to the 'Import/export data' section of your store's Admin area. In X-Cart versions 4.4.0 and later, this section can be found at Tools menu -> Import/Export; in X-Cart 4.3.x, this section can be found at Management menu -> Import/Export; in earlier versions, this section can be found at Administration menu -> Import/Export.
  2. On the menu at the right side of the 'Import/export data' section, click the Export data link.

The 'Export data' section looks like this:

Export.gif
However, the section [+] Select provider is available only to X-Cart PLATINUM/PRO administrators, and the set of data types available for exporting varies depending on the type of user account being used.

To export data to a CSV file:

  1. Use the settings of the 'Export data' form to specify, what data you wish to be exported, and how you wish that to be done:
    • (If you are an X-Cart PLATINUM or PRO administrator) If you wish to export not all the data, but just the data of a specific provider, specify the username of the provider, whose data you wish to export: expand the 'Select provider' subsection of the 'Export data' form by clicking on the [+] Select provider link, enter the username of the provider in the corresponding field and then click the Go button.
    • Use the 'CSV delimiter' drop-down box to select the delimiter you wish to be used in the resulting CSV file (Semicolon, Comma, Tab).
    • If you wish the export spreadsheet to be split into several parts (each in a separate file), use the 'Data rows per file' field to specify the maximum number of data rows that can be contained in one file. Leave the field empty or enter 0 (zero) if you do not want to split the export file.
    • Specify whether you wish to export images (Yes/No).
    • Use the field 'Category path separator for "category" field' to type in the character or sequence of characters that you wish to be used as the 'category' field separator in the export CSV file. You can use any character or sequence of characters that does not occur in the category names.
    • Select the data that needs to be exported:
      • If you are going to export USERS, PRODUCTS or ORDERS, adjust the respective data ranges (use the links in the RANGE column).
      • Select the types of data that need to be exported (select the check boxes next to the names of these types).
  2. Click the Export button at the bottom of the 'Export data' form. X-Cart should now start exporting the data. The export packs will be saved to the /xcart/var/tmp directory.
    When the export process is over, you will see an information box with a confirmation message and the link to the export packs.
  3. Click on the Export packs link in the Information box or scroll down to the bottom of the 'Export data' section. On the 'Export data' form, you will see a new subsection 'Export packs', which lists the CSV files you have just created with the exporting procedure.
  4. Download the export pack files to your local computer by clicking on the filename links.

If you wish to remove the export packs from the directory where they were saved by X-Cart, (/xcart/var/tmp), you can delete them through the X-Cart interface.

To delete export packs:

  1. Expand the 'Export packs' subsection of the 'Export data' form.
  2. Select the check boxes next to the export packs that need to be deleted.
  3. Click the Delete selected button. The selected export packs should be deleted. You will see an information box with the confirmation message.

See also:

Importing Data

X-Cart 4.4or above

You can import the data from your X-Cart store in the 'Import data' section of your store's admin area.

To access this section:

1. Go to the 'Import/export data' section of your store's admin Area. In X-Cart versions 4.4.0 and later, this section can be found at Tools menu -> Import/Export; in X-Cart 4.3.x, this section can be found at Management menu -> Import/Export; in earlier versions, this section can be found at Administration menu -> Import/Export.

2. On the menu to the right of the 'Import/export data' section, click on the Import data link.

Import procedure

The 'Import data' section looks like this:
Import.gif
However, the section [+] Select provider is available only to X-Cart PLATINUM and PRO administrators, and the set of data types available for importing varies depending on the type of user account being used).

To import data to X-Cart:

1. Prepare the CSV file to be imported.

Make sure of the following:

  • The charset of the file to be imported matches the system locale.
  • The file contains all the required fields (see the table in the 'Import options' section of the 'Import data' form — click on the plus sign).
  • The types of the data to be imported are listed in the table (if not, check whether the respective modules/add-ons that use the data types are enabled).

2. Use the options of the 'Import data' section to specify the data to be imported and the import method:

Note: X-Cart PLATINUM/PRO administrators! Certain types of X-Cart data (like PRODUCTS, SHIPPING RATES, TAX RATES, etc.) do not appear in the table and cannot be imported without specifying the provider the data belongs to. When importing provider specific data, be sure to enter the data owner's username in the corresponding fields of the 'Select provider' section.

3. Use the 'CSV delimiter' drop-down box to select the delimiter used in the CSV file you are going to import (Semicolon, Comma or Tab.

4. Specify the source of the import file, i.e. where the file is located physically. That can be the server running your X-Cart store, your local computer or some web-accessible location (Server, Home computer, URL). Depending on the selected source, provide the file path or URL.

5. Expand the 'Import options' section by clicking on the [+] Import options link and adjust the settings in this section as described below.

6. Click the Import button at the bottom of the 'Import data' form.

X-Cart should now start importing the data.

When the import process is over, you will see the respective confirmation message.

Import options

You can make additional settings by expanding the [+]Import options link and adjusting the required parameters:

  • If you are importing products, set the Default category (a category where your products will go if you have not specified a category in the 'Category' column. Just skip this field if you have specified the category in your CSV file).
  • If you are importing users, specify, whether customer passwords are encrypted (Yes/No).
  • If your CSV file mentions subcategories (e.g., if some of the products being imported go into subcategories), make sure that the Category path separator for "category" field in the 'Import options' section matches the separator in your CSV file.
  • If you are importing images (thumbnail images, product images, category icons, etc.) and wish to import them from a single directory, specify that directory in Directory where images are located.
  • If your store's database already contains data of the types that you are going to import, and you wish to drop that data before importing data from your spreadsheet, select the DROP check boxes next to the data types that need to be dropped. (If you do not select any of the check boxes, the data from your spreadsheet will simply be added to the database).

General Notes on CSV Format

The file format used to import/export X-Cart store data is called CSV, where CSV stands for 'Comma Separated Values'. It is a popular delimited data format that nicely suits the purposes of exporting data from X-Cart database tables, editing the exported data in an external spreadsheet editor and re-importing the data back into X-Cart.

A CSV file is a text file where each line represents a separate data record. Each record consists of fields separated by a designated delimiter (a comma, a semicolon or a tabulation).

Being a text file, a file in the CSV format can be opened and edited with any decent text editor. However, editing large volumes of CSV-formatted data with a text editor is likely to turn out a frustrating experience, so you might prefer to use your favorite spreadsheet software application, like MS Excel, to arrange the contents of your CSV file as columns and rows. Arranging your store data as columns and rows in a spreadsheet software application is sure to make editing a whole lot easier, but please be aware that, depending on the spreadsheet application you use, you might need to readjust the cell format for some data types so the data is displayed properly. Before re-importing the data edited in an external spreadsheet program back into X-Cart, be prepared to check the CSV file for any extra spaces or punctuation marks that might have been inserted by the spreadsheet program.

Structure/Formatting of a CSV File for Use with X-Cart

Depending on your needs, a CSV file generated by X-Cart or intended for importing into X-Cart may contain data of one or more X-Cart data types (for example, categories, products, users, destination zones, etc). All types of X-Cart data imported/exported as CSV come as string or numeric values.

Note: Graphics (like category icons, product thumbnails, detailed product images) or other complex data objects (like digital media files for ESD products) do not get saved to the CSV file itself, they are just referenced by URLs or filepaths pointing to their location.

The principles of formatting are the same for both import and export CSV files:

  • Within the file, the data is grouped into sections according to the data type.
  • Each section has a title. A section title represents the name of the data type imported/exported in the section, written in capital letters and enclosed in square brackets. In data type names consisting of more than one word, the words are separated by underscores. For example, if you export your store's config data, information on users, user memberships and product extra fields, you will get sections titled [CONFIG], [USERS], [MEMBERSHIPS] and [EXTRA_FIELDS] respectively.

Exact section titles can be found in the chapters discussing the format of import/export sections for various types of data (See the section [import_export/csv_format_various_data_types.htm CSV Format for Various Data Types] of this guide).

  • Within any section in your import/export CSV file, the section title is followed by a header row - a row containing field names. Each field name serves as a column heading, is written in capital letters and is preceded by an exclamation mark. Below the header row goes the data imported/exported through the section. The data comes as a list of records, where each record begins on a new line and provides values for every field named in the header row. Both in the header row and in the data records, fields are separated with a delimiter. The delimiter may be a comma, a semicolon or a tabulation (The same delimiter is used throughout the file).

Example:

[ZONES] <- section title
 !ZONEID;!ZONE;!COUNTRY;!STATE;!COUNTY;!CITY;!ADDRESS;!ZIP <- header row
1;New York;US;US_NY;;New Yo%;; <- data row


Names of import/export fields and information on the format of data that can be imported/exported through these fields can be found in the chapters discussing the format of import/export sections for various types of data (See the section [import_export/csv_format_various_data_types.htm CSV Format for Various Data Types] of this guide).

  • If a certain field contains the delimiter symbol as part of its value, the whole field is enclosed in double quotes ("). If a text field enclosed in double quotes contains another double quote symbol, that double quote symbol is doubled to be considered a symbol rather than the end of the string marking.

The following is a sample of a CSV file with a comma delimiter and double-quote text qualifier symbols enclosing the !DESCR field value (also note the duplicate double quote symbol after the double quote denoting inches):

[PRODUCTS]

!PRODUCTID,!PRODUCTCODE,!PRODUCT,!DESCR

182,SKU182,Hunting Knife w/sheath,"This 8 1/4 "" beauty will make a great addition to your knife collection or a great gift for that special person. A quality hunting knife with a heavy 4-inch blade and an overall length of 8.25-inches. Hand crafted from only the finest materials."

The same data will look like the example below if a semicolon delimiter is used (no double quotes around the !DESCR field, as well as no duplication of the "inches" double quote symbol):

[PRODUCTS]

!PRODUCTID;!PRODUCTCODE;!PRODUCT;!DESCR

182;SKU182;Hunting Knife w/sheath;This 8 1/4 " beauty will make a great addition to your knife collection or a great gift for that special person. A quality hunting knife with a heavy 4-inch blade and an overall length of 8.25-inches. Hand crafted from only the finest materials."

Fields may always be delimited with double quotes.

See also