2.4. Import Categories
When you import categories to PrestaShop pay attention to each Wizard's page. Import is a rather complicated procedure and it may be destructive if performed incorrectly.
Create database backup before importing PrestaShop categories especially if you do it for the first time!
Prepare the file to import
First of all, prepare a .csv file for Import. Make sure it contains all necessary fields and all data you are going to import as listed in the table.
You should have the following data in your file to import as:
"Category ID" or /and "Category Name" - at least one of these fields should be in the file to import to be able to use it as an identifier for imported data.
"Active" - the status of the category activity; '1' - active, '0' - inactive
"Position" - the order of the categories in the category tree
"Is Root Category" - set imported category as root or not
"Description" - text, which helps to get more details on the category(/ies)
"Friendly URL" - the end of the URL path(s) of the category(/ies) which will be generated for preview category(/ies) on the Front-End, etc.
"Category Name (FR)" - imports values to a specific store (in our case, to French)
"Category Image" - upload/assign images during import
"Category Groups" - assign category to specific group
Categories Import steps:
Launch import wizard
To start Import/Export you need to click on the[Import/Export] button, which starts the Import/Export PrestaShop Categories Wizard in the top of Store Manager:
Or you can find "Import/Export Categories" option on the "Categories" toolbar:
Select "Import" in the PrestaShop Categories Import/Export Wizard and click on the [Next >] button to continue.
Store Manager can export PrestaShop categories from .csv file. Enter the .csv file you need to import or press [Browse] button to select one.
Select Fields Delimiter and Quote Character
Select fields delimiter and quote character page contains important settings. If you specify wrong values, PrestaShop category import may not work.
The first option is delimiter character. Most popular delimiters are comma (,), semicolon (;) and tab character ( ), however, other symbols can be used as well.
Note: CSV file contains data in a row-column format and delimiter character is used to separate one column from another. If you specify incorrect delimiter, file will not be parsed properly and PrestaShop categories will not be imported.
Quote, string values delimiter will be used to separate strings in a .csv file. This delimiter can be disabled if none are used. On previous sample page, we have noticed that comma symbol was used as delimiter and values were quoted with " symbol. Specify two first settings as shown above.
The third setting is PrestaShop category delimiter. This is not native .csv setting, it is used only in Store Manager. As you know, categories are organized in a form of a tree, where parent category can contain one or more subcategories and subcategory can contain one or more other categories. Category delimiter character is used to separate category names and specify full category tree path for given category.
Category path is very similar to directory path used to specify the full file name in Windows, where every directory is separated by a backslash (\) character like this one: C:\Program Files\eMagicOne\Store Manager for PrestaShop\
As for example, PrestaShop category path for "Sample Subcategory" (see image below) will be Hardware|Graphics Cards|Sample Subcategory. Pipe (|) character is used as a separator.
Default images path is the place where store manager will look for images when importing Prestashop categories - image names specified in .csv file whereas image files stored here.
When a Store Manager is unable to find an image, it will not import image information to a category and will remove existing image information if any.
Base formats and separators
Parameters on the "Base Formats and Separators page" are used to convert text values from the .csv file to numerical and date values. You can set default formats with corresponding button.
Assign .csv Columns to Database Fields
The next page allows you to link columns from .csv file to proper database fields. The left pane "Database Fields" shows the list of fields in your database that can receive import data.
On this page you have to specify following information.
First option is "Identify categories by". Import will search for PrestaShop category using selected identify method. The category will be modified if found, if not - new category will be added.
Source .csv file can contain multiple records with identical Name values. All these PrestaShop categories will be considered as one - currently imported to PrestaShop categories will overwrite previously imported with the same key field values. Note that sometimes one of key fields may be blank. Blank fields contain the same value for all records. It is required to assign .csv columns to key fields.
Next option on this page is "First row contains field names" but not values. If the first row of your .csv file contains data, you should uncheck this option, otherwise, check it.
"Database Fields" contains these columns:
"Name" - database field name. Some values in this column contain actual field name, whereas other are "translated". These names are clear enough to figure out how to use them.
"CSV Column" - the name of the column in .csv file corresponding to this field - the link between database field and .csv column.
"Expression" - column where you can insert a special formula next to the proper field of the database to convert data during import (it may be combining certain fields or their replacement, moving or adding additional text or values, etc.)
To assign .csv column to database field you should select a field in the left pane and then click a column in the right pane.
On the bottom of ".csv file columns" there are three buttons:
[Auto Fill...] button tries to set correspondence automatically for all fields. Will work only if "CSV Column" name is the same as database field name ("translated").
[Clear] button clears all "CSV Column" values in the left pane.
Click [Next] if you specified everything.
Preview import data
PrestaShop Categories were not imported to your PrestaShop database yet. On "Preview Import Data" page you can see how .csv file was processed using import settings, which you specified at previous steps.
Check whether all columns that you want to be imported are filled with data: some of them may be blank. This means that either you haven't assigned .csv column or it is empty in source (.csv) file.
Columns that were not assigned will not be imported whereas empty values will overwrite existing.
Choose one of import methods.
Please note, from the last program's update (v.22.214.171.1243), you are able to associate categories which are importing with the proper stores. Just check the checkboxes from a list below:
Attention! Import process starts when you press [Import] button! If all settings are correct, then continue the procedure, otherwise, press [Back] button and check settings once more!
In the last window of PrestaShop Import Categories Wizard it is shown if any errors occurred during the import process.
Most frequent import errors are date, time and number conversion issues caused by improper format settings (specified at previous page) or improperly assigned column (i.e. if you assign column containing PrestaShop category ID to parent_category database field). Date/time conversion errors might be ignored whereas other errors, like this one: "Could not find image:image_name.gif", are better to be fixed.
The following video tutorial shows the main import categories' steps in practice:
Check PrestaShop Category Management section to find more about category editing.
Here are some related articles on PrestaShop Categories Import: