Magmi command line

From Magmi Wiki
Jump to: navigation, search

Magmi CLI interface

magmi can be launched from command line once configured by its UI page

As soon as you configured magmi and saved a profile , magmi cli interface can be used.

How to run

Basic Options

  • go to magmi/cli directory
  • launch magmi cli with the following command line syntax
php magmi.cli.php [-profile=<yourprofilename>] [-mode=[update|create|xcreate]]
  • all parameters are optional

Advanced Options

Profile Chaining : -chain=[profile:mode,....]

Sample

php magmi.cli.php -chain=<profilename1>:<mode1>,<profilename2>:<mode2>

This woud run magmi with profile1 & mode1 and continue by running it with profile2 & mode2/ This allows setting up a workflow in a single command line.

Alternate configuration : -config (magmi 0.7.20+)

Sample

php magmi.cli.php -config=[/alternate/config/path/]custom.ini -profile=<yourprofilename> -mode=create

Case 1 : Easy mode , no specific path

php magmi.cli.php -config=custom.ini -profile=<yourprofilename> -mode=create

Case 2 : Complete mode , specific path

php magmi.cli.php -config=/alternate/config/path/custom.ini -profile=<yourprofilename> -mode=create

This would also make magmi consider the parent dir of custom.ini (/alternate/config/path) as the new config root. => This means all profiles that could be used with this custom.ini file should be also located under (/alternate/config/path)

Parameters

  • -profile=xxx , xxx should be an existing saved profile. if -profile is not set magmi will run with "Default" profile
  • -mode=[update|create|xcreate] , if -mode is not set magmi will run in "update" mode
  • -chain=profile1:mode1,profile2:mode2,....,profileX:modeX , multiple profile run in a row.

all profiles to run should be listed in a comma separated list

  • -config=/path/to/somefile.ini , use alternate magmi config file & directories (based on somefile.ini parent path)

mode values

  • update : will skip non existing skus & update existing ones
  • create : will create new products for non exisiting skus, will update existing ones
  • xcreate : will create new products for non exisiting skus, will skip existing ones

Useful Hint

Magmi Import Url UI plugin has an option to give the command line to use for current edited profile in the UI ;)

Example

Say you want to run profile "myprofile" in mode "create" (ie: create new, update existing)

php magmi.cli.php -profile=myprofile -mode=create

Advanced syntax : profiles plugins parameters override

Magmi CLI enable to override plugins parameter from profile

This feature could be particularly useful for CSV Datasource parameters, enabling to switch input files.

This feature could be used to override ANY plugin parameter for plugins that are selected in the profile.

Example

  • Same as above but forcing csv file to "/home/myuser/toto.csv"
php magmi.cli.php -profile=myprofile -mode=create -CSV:filename="/home/myuser/toto.csv"



Back to Magmi Wiki