My work at Aleva Stores has given me some experience with using Magmi to import inventory levels and new products. Creating new products and assigning image, links between simple and configurable products. All a whole lot faster than the default dataflow import system. Not as good as other methods like API Import but good enough for my current uses.
My setup is a generic Magento CE 184.108.40.206 install with the sample data installed. This also assumes that your attributes and attribute sets are created.
Installing and Setting Up Magmi
Setting up Magmi is fairly easy. All you need to do is download the package from the project website. Unzip the file and upload the directory to your root magento directory. Probably a good idea to put some security on the folder since Magmi has a lot of power and getting access to the system can cause some issues.
Download the Magmi Utilities Plugin zip file. Navigate to the Magmi web interface located at domain.com/magmi/web/magmi.php and use the “Upload New Plugins” section to upload the zip file for the Magmi utilities.
Next fill in the database information under the “Configure Global Parameters” section with the information for your install of Magento and press the ‘save global parameters’ button. You can see the areas I filled in below:
Quick note on CSV files
The easiest way to create a CSV export file is to create a test product inside Magento and then use the dataflow export to export that product. Then once you have that you can augment the CSV and expand it to include the extra columns for Magmi. At the end of every section I’ll also include links to my example CSV files I created. Save all files in UTF-8 encoding to ease your problems.
All my magmi related fields start at column CC in my CSV files. The other ones are magento default columns and attributes for the default data. Your file may be larger or smaller depending on your setup. And for the most part any non-required columns can be removed from the CSV files.
Importing Simple Products
First create your CSV file of your products. Including the required information and extra fields or attributes that you are using. Upload this file to the magento directory’s var/import folder. If that folder doesn’t exist create one. Here is an example one I created for my test store.
Next under the ‘Configure Current Profile’ section you should create a new profile based off of the default profile. I create a new profile for each type of import I am setting up. One for simple products, one for configurable products and their simples, one for inventory syncs, and so on. Give it a name then press the ‘Copy and Switch’ button.
The third step is altering the plugins that are used for this profile and the CSV file. For this simple product import I only need to add images. So I select the Image attributes processor plugin. By clicking the configure link for the plugin you can see various options. The only option I changed was Import Image Mode. By changing it to overwrite it will overwrite any changes that are there if the product is new. For most of what I use it for this is the mode I need. Your usage may vary depending on how you are working with it. Once that is done scroll all the way to the bottom and click the save profile button.
Next upload your images to media/import, if this folder doesn’t exist simply create it. This is the default image import directory, if you alter it in the Image Attributes Processor plugin make sure the images are uploaded to that folder.
The last thing to do is select the file to be imported and the CSV seperator and enclosure items. In the image below you can see that I’ve selected simples.csv for the file to import (the file is located in var/import) and for the seperator I use a comma (,) and for the enclosure I use a pipe (|). I find these to be good settings for my normal usage but how you save your CSV file may differ. For instance you may use the pipe character for meta information so using a tab character (\t) will work better or simply a double quote mark (“). Once you have filled in these options again scroll down and save the profile.
Once the page refreshes you are now ready to import the file. You can do one of three methods. Update existing items only, skip new ones; create new items & update existing ones; create new items & skip existing ones. Each one has a use. Depending on what you are doing you need to pick the right one. For instance if you have a huge list of new vendor information and only want to update products you already have in your system update only is a good choice. Or if you have that same list but only want to add the products you don’t have in your system the create and skip is a good option. Then if you want to do both create and update is the choice you need to make.
Make sure the profile selected is the one you wish to run and press the run import button.
This is the import screen that you receive when it runs. It will give you some basic output to help you diagnose issues.
Now you can look at these products in the admin or frontend but you will see one issue. The first image (base/thumbnail/small image) are excluded from the gallery. To fix this just add a plus sign (+) to the base/small/thumbnail image file(s). Depending on your needs again you may want to exclude some of the images and by default magmi doesn’t include those three. Here is the fixed CSV file.
Also make a note that the image label keeps getting overwritten for each of the products because I used the same image for all three base/thumbnail/small images. Depending on your image setup you may exclude the small and thumbnail images (don’t put a + in front of the image) and have different labels for them.
Importing Configurable Products and Assigning Simple Product Connections
Ok, configurable products are very similar to simple products. A few changes have been made in my configurable product CSV file. The two additions that are magmi related are for the simple sku association and the configurable options. The simple_skus is just a comma separated list of the skus that are being used. The configurable_attributes column is a comma separated list of the attributes being used. In this case it is size and color. Make note the order is important. It will be the order that is displayed on the frontend. Here is the CSV file.
Upload the CSV file and images to var/import and media/import like with the simple product file.
As with the simple products I create a new profile. This one I use to import configurable products and their simple products. So once you create a new one it should be setup exactly like the one you copy it from. In my case I copy and switched from the simple profile. That way the image processor is already setup. So all you need to do is change the file that it will import and setup the configurable product item processor.
Select the configurable item processor under Product Type Import. Press the configure link for it and make sure the Preform simples/configurables link is set to yes. I personally also set the Force Simples visibility to Not Visible Individually. In our case we set all simples that are part of a configurable product to that setting. If your needs differ then alter it.
Save the profile and double check the file is correct for the import and let it run on the update method you need for your store. In my case I’m running it with create new items and update existing ones.
Once all of these are done if you followed along this is the result I got on the category page for men’s shirts (the category I put all the products in).
For more information on the product plugins I suggest reading up at the wiki here. That is where I pieced together what I now understand for the system and will eventually go back to learn the bundled and grouped products when the time comes. I may even write a post on creating them when that happens.
In another post I’ll show you how to automate importing quantity updates via a cron job with Magmi (easy inventory syncing).