Magento Mass Importer (MAGMI) Documentation

Last modified by zuiko on Fri, March 18, 2011 12:12
Source|Old Revisions  

This is an old revision of the document!


MAGMI currently imports several thousand products per minute and can be downloaded on Sourceforge: http://sourceforge.net/projects/magmi

How to install it

  1. From the SF project web site, download the main file of the project, (for example magmi_0.6.14.zip)
  2. Unzip the archive under your magento root directory , it will create a magmi directory. (server OVH→Setting permissions to 705)
  3. From the SF project web site, download the plugins useful for you (there are 2 main packages magmi_base_plugins.zip and magmi_extra_plugins.zip and you can also download plugins individually (last version of some for example).
  4. Go to /your_magento_root_directory/magmi/web/magmi.php (if error 404 then disable url rewriting)
  5. install the plugins you want by the button “Upload New Plugins” and choosing the zip files downloaded. The installed plugins will appear on the Itemprocessors list with their version. You can here activate or disable it then click on the Applyconfiguration button.
  6. Copy the csv file you want to import into the /var/import directory

How to run it

As written before, open the following URL in a browser:

/your_magento_root_directory/magmi/web/magmi.php

After having filled the indispensable informations on the Configuration page and having choosen to activate the needed plugins, click on the button “Apply configuration”. Corresponding to the enabled plugins, the second page asks you for some changes and additions. The most important things to report are:

  • Import parameters, mode: create (add new products) or update only (update existing products)
  • Data Source: the file to import with csv separator and csv enclosure used
  • The other information depends on the enabled plugins and are fairly well documented.

How to upgrade it

From version 0.6.16, an upgrade tool has been incorporated in the Magmi tool (on the top of the configuration page: “Update Magmi Release”).

  • Download the new version on Source Forge (zip file)
  • Use “update Magmi release” to update

Each plugin can be upgraded individually just as a first installation “Upload New Plugins” on the configuration page.

Import new products

Import parameters, mode: create.

Be careful to have all mandatory columns (as understood by ) Magento filled for each product.

Magmi will be able to work with these following mandatory columns in csv & header (but insufficient for Magento to show your products in front end):

  • “store”,”attribute_set”,”type”,”sku”,”websites”

The syntax for the store column can be a list, for example “admin,store1,store2”

  • for multiple images, the column header name should be “media_gallery” , this should not include main image otherwise this will be replicated in the ‘other views’ pane of the product.
  • Custom attributs select and multiselect type: Magmi creates, on the fly, new values for custom attributs of these types but, by this way, only one value is possible for all stores for one sku (one product).
  • Categories:
    1. Without Category Importer/Creator : category ids should be defined as of magento export (ie , comma separated category ids).
    2. With Category Importer/Creator : categories defined in categories column will be used/created on the fly.

Update existing products

Import parameters, mode: update.

Mandatory columns in csv & header:

  • “store”,”sku”
  • Custom attributs select and multiselect type: if you give a new value for an attribut of these types, Magmi will create it on the fly.

However, values will be created “per store” , so if you have a select/multiselect column called myselect and then several items declaring different values for different stores. one new value entry will be created per store. so no “translate” behaviour with multiple values associated to the same option value but a specific set of option values will be available per store. example for following csv structure:

  "sku","store",....,"myselect"
  "sku1","store1",....,"value1"
  "sku1","store2,store3",....,"value2"
  "sku2","store1",....,"value3"
  "sku42","store1",....,"value4"
  "sku37","store2",....,"value5"

the result will be the following:

  • in store 1, the “myselect” will propose “value1,value3,value4”
  • in store 2, the “myselect” will propose “value2,value5”
  • in store 3, the “myselect” will propose “value2”

User tips between create and update modes

The best practices to avoid useless information in the data base and to optimize performance are the following:

  • Create mode: use it with all possible default information with only the admin store in the store column.
  • Update mode: use it, in a first time, to change just information needed in some stores (translations in foreign languages in dedicated store views for example).
  • Update mode: use it, regularly to change default information with only the admin store in the store column.

Import downloadable products

Can’t be done at the moment. This is a known limitation.

Import categories

Category Importer/Creator plugin can be used to create categories using a syntax that enable to define a full category tree.

Import Images

Magmi supports both local image & remote image import from urls. it also supports image gallery to associate multiple images with a product All image import is done by using Image Processor Plugin

Update stock

tbd

Handle end of life products

tbd

Handle new products after the initial import

tbd

Item processors

Column Mapper

  • This plugin enables you to change the column names from the datasource (ie:csv) before they are handled by magmi.

This is needed when csv column names do not match magento product attributes names.

  • This plugin also has the capability to replicate data from one csv column to many attributes.

The replication feature is very useful when you have only one image column and want it to be used as small_image & thumbnail value.

Default Values setter

This plugin enables you to define some default item values if they can’t be found in the input source.

How to use:

Default attribute list: Add the column names of the attributes you want to set a default value for (separated by commas). Once you leave the text field (click somewhere else with the mouse) new text fields will appear. Now fill in your desired default values for each attribute.

Magmi Import Limiter

This plugin makes it possible to import only products that match a certain criteria.

How to use:

  • Limiter ranges: Define a product range to be imported

Examples:

Import only the first 100 records of the CSV:

1-100

Import all records after 99 (including 100th):

100-

Import records 1 to 10, 40 to 50, 67, 78 and 89

1-10,40-50,67,78,89
  • Limiter filters: Only products that match the filter (regex) are imported. Use regex!

Examples:

Exclude all SKUs beginning with 00:

sku::00.*

Exclude all items that do NOT contain the term blue (the ! before the name field inverses the filter)

!name::.*blue.*

Exclude all items with SKUs beginning with 00 which name does not contain the term blue

sku:00.*;;!name::.*blue.*

Generic mapper

This plugin provides value mapping for CSV values before they are handled by magmi. Typically, visibility and page_layout need to be mapped for MAGMI to process them correctly.

To adjust the mappings to your config, please edit the CSV files located at :

magmi/plugins/itemprocessors/genericmapper/mappings

The naming convention of the CSV files is:

[column_to_map].csv

For example, if you want to map is_recurring, you have to create a file named is_recurring.csv (utf-8 encoded) in the folder magmi/plugins/itemprocessors/genericmapper/mappings Its content could be:

"Yes",1
"No",0

if the values included in your importation file are coded “Yes” or “No” in the is_recurring column.

Warning: For Magmi version < 0.6.16

  • Don’t create a file status.csv to map the status by this way. It does’nt work like this for this item.
  • The status has to be mapped with the dedicated box “Enabled Status” on the Magmi configuration page.

For example, if you indicate “Activé” in this box (french word for activated), all products with the word “Activé” in the status column of your importation file will be enabled.

For Magmi version >= Magmi 0.6.16 this behaviour changes:

  • no more default enabled status, now use genericmapping plugin, but defaults to “enabled” if no plugin is used.
  • generic mapper now handles status, added “default” mapping subdir that matches english language mapping , continue to put your custom mappings in “mappings” directory. It will not not be erased nor modified in case of plugin generic mapper upgrade.

Category Importer/Creator

Using this plugin supersedes the category_ids column

This plugin enable to define the category tree levels where the item should be put.

the column name for defining category tree levels is categories the syntax is the following

level1/level2/level3,level1bis/level2bis/level3bis

so, all branches where the item should be put should be separated by a comma (,) and each branch level should be separated by /.

Non existing levels will be automatically created. Existing levels will be reused.

The above description will lead to the following category tree to be created/used

Root Category
 +level1
  + level2
    + level3
 +level1bis
  + level2bis
    +level3bis

if a futher item in the source has the following categories column

level1/levelextra2,levelextra1

the tree will become

Root Category
 +level1
  + level2
    + level3
  + levelextra2
 +level1bis
  + level2bis
    +level3bis
 +levelextra1

and so on...

so the category tree will be built “on the fly”.

On each branch level, extra parameters can be defined using the following syntax: category name:[x]:[y]:[z] with x,y or z optional with:

  • x : 0 or 1 - category is_active flag (defaults to 1 if not set)
  • y : 0 or 1 - category is_anchor flag (defaults to 1 if not set)
  • z : 0 or 1 - category include_in_menu flag (defaults to 1 if not set)

example:

 level1/level2:0:0:0/level3:1:1:0

The plugin defines the following optional parameter:

  • base category tree

This enable to prepend a defined tree level to all category tree levels defined in the import source.

Advanced usage: The base category tree may be interesting to use it in conjunction with import limiter , so you can prepend a category tree for only some of the input data (using some limiter ranges or filters) and use another base tree for another set of input data (using other limiter ranges/filter)

Image Processor

Compatibility : 0.6.16+ This plugin is mandatory if you want to import images. It presents the following fields:

  • Read local images from

This enable you to setup from where local images are read. If a relative path is used, it will be parsed as relative to magento directory If an absolute path is used, it will be used as is. Defaults to “media/import” standard magento local image dir.

  • Image Renaming

Particularly useful when dealing with remote urls, this field lets you choose the final name of the downloaded image using a tag based syntax.

Syntax for image renaming

General expression : any string containing {item.xxx} and/or {magmi.yyy} where
 xxx can be : any of csv column name or plugin created column.
 yyy can be : filename|filename.noext|filename.ext|store|attr_code

{magmi.yyy} values details

 {magmi.filename} : original image filename
 {magmi.filename.noext} : original image filename without extension
 {magmi.filename.ext} : original image filename extension (if exists)
 {magmi.store} : current processed store id
 {magmi.attr_code} : name of the column.

Using magmi.store & magmi.attr_code may lead to same image being duplicated to match all needed names.

  • Image Import Mode

Magmi lets you choose between 2 image import modes:

  • Keep Existing Images

This mode won’t rewrite or redownload (for external urls) images if image with matching target name already exists.

  • Overwrite Existing Images

This mode will force a rewrite or redownload (for external urls) images even if image with same target name exists.

  • Changes Attributes on Error

This field let you define attributes to be modified in case of image download/reading/writing error.

You can enter several attribute names separated by commas, dynamic fields will appear for each attribute to let you choose the value to set in case of image error.

So you can disable a product with image error by changing its status or enter a value in some custom field(s) of your choice.

Raw values only supported by now for error set attributes, ie : for status use 2 for “Disabled”

Custom Options

The principle is to use one column of the csv file to describe each option by a specific syntax described below.

WARNING: for custom options one thing important:

- each time you import custom options for a product, each time there are entirely rebuilt for this particular product. So the consequences are the folowing:

  • ⇒ if you want to update, for some products, just some data (description, url key...) for a store view (translating some text for example) without lines for the other store view don’t use any custom options column (in this case you can let or no the custom options plugin activated, it will have no action). A simple custom options column is sufficient in the file, in this case, to replace all preceeding custom options for the concerned products. An other possibility to not have the risk to break custom options is to disable the custom options plugin in the magmi web interface.
  • ⇒ if you want to update custom options (to translate texts for example), in fact, you have to enter all the concerned store view product lines (sku ordered) in the same file to be sure to not break the admin/default view or others by a specific store view.

Syntax To import a custom option you need to add a new column to your CSV import file. The name of the column (header line of the file) determines the name and type of the option. The format is:

Name:Type:Is Required:sort number

(with :sort number optional) . For example, to create a required drop down option called “Size” your column header should be:

Size:drop_down:1:1

(1 for required, 0 for optional and 1 at the end for the option sort number one). Here is a list of the Types, these are taken from the “Custom Options” screen in the Magento admin

  • field: Field
  • area: Area
  • file: File
  • drop_down: Drop-down
  • radio: Radio Buttons
  • checkbox: Checkbox
  • multiple: Multiple Select
  • date: Date
  • date_time: Date & Time
  • time: Time

For types with multiple values (drop_down, radio, checkbox, multiple) you can specify using a | separator. Example for Small, Medium, Large you would use

Small|Medium|Large

as the value for the

Size:drop_down:1:1

column in your csv file.

Here’s paired down example of the import format:

sku,name,description,price,Size:drop_down:1
T-Shirt1,T-Shirt,A T-Shirt,5.00,Small|Medium|Large
T-Shirt2,T-Shirt2,Another T-Shirt,6.00,XS|S|M|L|XL

In addition you can specify an addition price and SKU modifier for each option value, and also an optional sort number for each value. The syntax for this is:

Value:[fixed|percent]:price_modifier:[sku_modifier]:[sort number]

For example if you have a product which costs $5 more for a Medium and $10 more for a large you would the following as the option value.

Small|Medium:fixed:5|Large:fixed:10

Here’s the first example with additional price/sku modifiers and, for the last, sort number.

sku,name,description,price,Size:drop_down:1
T-Shirt1,T-Shirt,A T-Shirt,5.00,Small:fixed:0:-SM|Medium:percent:2:-MED|Large:percent:3:-LRG
T-Shirt2,T-Shirt2,Another T-Shirt,6.00,XS:fixed:0:-XS:1|S:fixed:0:-S:2|M:fixed:1:-M:3

You have understood that you can can order the values for one option with the last digit of each value like this example:

[Size]:Small:fixed:0.5:-S:1|Medium:fixed:0.6:-M:2|Large:fixed:0.7:-L:3

⇒ Small 1st, Medium 2d, Large 3rd

text field and text area:

You have to specify a value for the option to be created, to create an input option with default values use: “:” as the value you just have to put something in the row so it’s not ignored. Here’s the format:

Title(optional):price_type:price:sku:max_characters

Example:

Header line                            Please enter your text:field:1:3
Admin/default store view product line   :fixed:0.5:Ref Text:35 

This would create an input field which prompt to customer will be “Please enter your text” with a fixed price of $0.5, a SKU modifier of “Ref Text” and a max of 35 characters.

file to upload field:

For the product line the syntax is:

[alternative prompt]:fixed/percent/0:price:reference:ext. file allowed comma separated:[width]:[height]

width and height are used for images and each one optional individualy.

Example:

Header line                            Upload a file:file:1:1
Admin/default store view product line   :fixed:0:Ref file:jpg,png:500:300  

multi store view compatibilty add a [new option label]: (with the square brackets & the colon) before the option values definition, except for text field and area options where square brackets are not necessary.

ie: if you had for french store (as default)

Petit|Moyen|Grand

and for english

Small|Medium|Large

the problem was that the option title would be set only using header value.

You can do:

Petit|Moyen|Grand

(keep as default) and for english

[Size]:Small|Medium|Large

of course, it also supports more detailed version of the syntax like:

[Size]:Small:fixed:0.5:-S:1|Medium:fixed:0.6:-M:2|Large:fixed:0.7:-L:3

and that’s it , you can have a new option label for your particular store !!!

you can handle text field and text area custom options with a slightly different syntax for the option title:

Header line                             Veuillez indiquer votre texte:field:1:3
Admin/default store view product line   :fixed:0.5:Ref Text:35
English store view product line         Please enter your text:fixed:0.5:Ref Text:35

the alternative title is indicated without brackets [], this is specific to text fields and text area.

Warning:

For multistore support, be careful to have all custom options definitions of all stores and admin in the same import file, sku ordered (very important to avoid breaking, for example, default store view by the last one for the custom options of the concerned products).

By cons, it’s allowed, in the import file, to have “holes” for some products for some custom options columns.

On the fly indexer

tbd

Tier price importer

tbd

Value Trimmer for select/multiselect

This plugin automatically trims values (remove blank characters at the end or the beginning of the string) for select/multiselect attributes.




 

Magento 2 GitHub Repository

Magento Job Board - Some sort of tag line goes here

Latest Posts| View all Jobs