2.4. Import Categories
This section describes the process of performing a category import into Magento, using a .csv file. It also describes how to perform a bulk update of Magento categories.
To import Magento categories, perform the following procedure:
- First of all, check, or prepare, a .csv file for import. Make sure that all required fields and data are contained, and correctly structured for import, into the category table.
- If the source category list(s) are provided in Excel, they can be directly converted to .CSV format within Microsoft Excel, OpenOffice, or similar application, by using the 'Save As' option. After accessing the 'Save As' dialog box (which also contains a list of alternative file formats), select the the 'Text .CSV' file (extension) format. Upon saving the file into .CSV format, Microsoft Excel, OpenOffice, etc., will export the first active worksheet with correctly formatted delimiters.
After preparing the .csv file, start Store Manager (if not previously started), open the "Categories Import/Export" wizard, and select [Import].
2. Import file name
Specify the full path, and the name of the .csv file. Or, use the browse button [...] to navigate to, and select a previously saved file.
Choose the relevant charset for the selected .csv file, from a saved list, or by using the "File Charset" drop-down. Alternatively, you may navigate to a previously saved configuration, that has similar formatting, column names, etc., by selecting the far right drop-down list, or by clicking the [Load Settings] button, retrieving a previously stored configuration file.
3. Preview .csv file
The Source file preview dialog shows a portion of the .csv file that was selected. There are no options to set, but you should pay particular attention to this page, carefully validating that the correct fields delimiter and quote character(s), are specified. Some files may have text enclosed in quotes, while numeric values may be unquoted.
Upon careful inspection of the second line of the example, you'll notice that some words are enclosed in quotes ("), and are separated by the semicolon (;) symbol. These are two important delimiters that you'll have to pay attention to, as you will have to confirm, setup, or configure these settings on the next page. Usually, it is enough to validate and confirm the first line, and not the entire file.
4. Select fields delimiter and quote character
Note: Wrongly specified values may result in a failed import process!
- "Select Delimiter Character". The most popular delimiters are comma (,), semicolon (;) and the tab character ( ). Other symbols may also be used.
- Note. A .csv file contains data in a row-column format, and a delimiter character is used to separate one column from another. An improperly specified delimiter will result in an improperly parsed file, and a failed category import process.
Remember, Store Manager for Magento supports the "comma" (",") as a separator when importing categories.
- "Quote string values". This delimiter separates the string values in the .csv file. It can be disabled if none are used.
- "Category delimiter". This is not a native .csv setting, and is used only in, and by, Store Manager. Categories are organized in a form of the tree. The Parent Category can contain one, or more subcategories. Furthermore, each Subcategory can contain one, or more, subcategories, and so forth. The Category delimiter character is used to separate category names, and to define the full category tree path for a given category. A Category path is similar to a Directory path, which is used to specify a fully qualified filename (including path), in Windows, in which every directory is separated by a backslash (\) character (i.e.
C:\Program Files\eMagicOne\Store Manager for Magento).
- Import images: You may also select whether, or not, to import images. Image filenames, and the image source directory, on your local PC (from which to export, or upload images), may also be specified. Note that you should configure the FTP connection, located on the Preferences -> FTP tab, before performing the import, to enable file transfer capability between your local system, and the remote server.
5. Select Store View for Import
Select the Store View(s) for which you are importing categories.
6. Assign .csv columns to database fields
The next page allows you to specify, and Link columns between your .csv file, and the corresponding database fields.
This dialog additionally allows you to specify the following options:
- "Category Identification Method". The Magento Import Categories Wizard will search for a category using the selected identification method. The corresponding category will be modified, and if not found, a new category will be added.
- Note: It is recommended to use the "Category Name + Category Path" option, to identify your categories. This is because new category IDs are generated automatically when you Import categories into Magento for the first time (import ignores your Category IDs). If you have chosen to export data to a .csv file, possibly for processing and further import, you may use the "Category ID" identification method, otherwise select the "Category Name + Category Path" option.
- "First row in the .csv file contains field names, but not values". This checkbox should be unselected, if the first row of your .csv file contains data, otherwise, be sure that it is selected.
- Link columns from .csv file to relevant database fields. The left pane "Database Fields" shows the list of fields in your database that can receive import data.
- The source .csv file can contain multiple records with identical Name values. The categories will all be considered as one category, and currently imported categories will overwrite previously imported categories with the same key field values. Note that sometimes one, or more, of the key fields may be blank. This is problematic, as blank fields contain the same value for all records. It is mandatory that valid .csv columns be assigned to key fields.
- Database Fields contains the following columns:
- "RecID" specifies the database field ID.
- "Field" designates the database field name. Some values in this column may specify the actual field name, whereas other are "translated". The names should be clear enough to determine their purpose.
- "CSV col" designates the number of the column in the .csv file corresponding to the currently selected field - It specifies the link between the database field and its corresponding .csv column.
- "Expression" allows you to create, and execute, SQL statements, within a pop-up dialog window.
The SQL statements must evaluate to a single return value.
To assign a .csv column to a database field, select a field in the left pane, and click the relevant column for the field, in the right pane.
- The [Auto link all..] button. The Auto-Set feature will attempt to automatically link the database fields with their corresponding columns. The Autofill option will work only if the .csv column name is the same as the database field name ("translated").
- The [Unlink all] button. This button will clear the left pane of all existing "CSV col" values.
7. Base formats
Base Formats and Separators are used to convert text values within the .csv file, to numerical and date values. Set the desired default values and formats, and click the [Set Default] button.
8. Preview import
Categories, at this stage, are not yet imported into the database.
On the "Preview import" page you can examine how, using your selected import settings, your .csv file was processed. Carefully verify whether all columns, that you want to be imported, contain data. Some columns may be blank, as they may not have been assigned, or the fields are empty in the source (.csv) file. Columns that were not assigned will not be imported, and empty values will overwrite any pre-existing values.
To attract your attention, any errors will be flagged with a Red blinking arrow. Examine, and fix, all errors.
9. Import options
The value selected on the "Import Options" page may affect your Import results. Carefully evaluate your choice and its possible ramifications.
- "Add and Modify". This option will add new categories, if not already in the database, and perform modifications to those that are found, if necessary.
- "Add Only". This selection will only add new categories. It will not attempt to perform modifications on existing data.
- "Modify Only". This choice will only update existing categories. It will not add new entries, even if the new category does not currently exist in the database.
- "Just Add". This option unilaterally adds new categories, without any validation checks. Be careful, as this may produce category duplicates, since Store Manager will not attempt to find already existing categories, but will add everything within its source file.
The [Save Settings] button allows to save import configuration.
All import settings can be stored under a named configuration. This facilitates a quick method of loading the parameters if in the future categories are imported into Magento from a file with similar formatting, column names etc.
Attention! The Import process will begin, once the [Import] button is pressed!
Proceed only if all necessary settings are performed and validated, otherwise, select the [Back] button and double check them.
10. Procedure complete
The final window of the Magento Import Categories Wizard will display any errors that may have occurred during the import process.
Possible import errors, that occur most frequently, are the date, time and number conversion issues, both of which are caused by incorrect format settings (specified in previous pages), or improperly assigned columns (such as assigning a column containing the Category ID, to the "Parent_Category" database field). Date/time conversion errors might be ignored, but other errors, such as "Could not find the image: image_name.gif", should be addressed and corrected.
Preview the video tutorial below to see how to import categories via Import/Export Categories Wizard tool in practice: