How to import products to magento using maento’s advanced data profile product import

A simple diagram depicting conversion of a CSV...
A simple diagram depicting conversion of a CSV-format flat file database table into a relational database table. (Photo credit: Wikipedia)

So, I’m writing this and such because, for the life of me, I could not find proper instructions to import a bunch of items into Magento via their native importer–maybe another day I’ll write up a guide on how to do this with a 3rd party interface…

Either way, here’s what I did to get about 2600+ items imported with images!

Now, this “guide” will be assuming a few things:

  1. You have a working Magento store
  2. You know how to generate a CSV file
  3. You’re familiar enough with Magento to navigate it’s administration section
  4. You understand your server’s file system and can upload files to said server
  5. You have this Import Product and Category plugin installed.

Edit: Since my original post, the free plugin I was using has disappeared from the Magento Connect site. I am now linking to a premium plugin that does this.

Anyways…

Creating your CSV file

First off, when you’re creating your CSV the following fields (attributes) are required values by Magento:

  • name
  • sku
  • type
  • price
  • status
  • qty
  • type (there’s a chance it may be _type)
  • attribute_set (there’s a chance it may be _attribute_set)
  • is_recurring
  • visibility
  • tax_class_id
  • attribute_set
  • websites
  • store
  • has_options
  • meta_title
  • meta_description
  • page_layout
  • store_id
  • image
  • small_image
  • thumbnail

You should be able to find the values necessary for those slots–I suggest creating a dummy product if you need to find the default values of any of these attributes.

After that, any custom attributes you have deemed required will be, you guessed it, required.

Dealing with Multiple Select aka multiselect values

This is effing terrible but the pattern you need to get Multiple Select fields working is:

[data][space][comma][space][data][space]…

Example:

  1. Green , Orange , Blue , Red , Grey

So, when you’re working in your CSV, make sure all of the values are within one cell (if you’re in Excel/LibreOffice/OpenOffice/etc.) or, if you’re working with the actual text-version of the file, enclosed in quotation marks within the comma-separated-value… that should make some sense…

Rumor has it there’s a limit of 100 values being selected at once in a CSV, but if you have a multiselect with over 100 values in it and users can choose more than one… I don’t mean to judge, but you may want to re-evaluate that…

Images! I want to do those too!

Cool. This isn’t that tough. Remember the image/thumbnail/small_image attributes from earlier? Here’s where they come into play.

Magento has this (seemingly) undocumented feature where if you want to import images when you import products through the advanced data profile section of their system it’s totally possible, but you have to follow these (again, undocumented) steps:

  1. Connect to your store’s backend via FTP/SFTP/whatever
  2. Navigate to the media directory
    • Wherever your Magento store files are located (i.e. index.php, etc.) there should be a directory named media
  3. Within the media directory create a new directory called import
    • It has to be this, I kid you not
  4. Add all of your images to this new directory
    • You can add subdirectories, but you’ll need to remember their names as they’ll be important in a minute

So, 4ish simple steps. Cool.

Next, you’re going to need to take all of the file names for the files you uploaded to themedia/import directory and put them in your csv file with a leading / (if they’re in subdirectories, those will be needed too).

Example:

  1. /stock_image.jpg
  2. /sub_directory/stock_image.jpg

One more caveat: The images must be jpegs. I don’t know why, but Magento only seems to like jpeg files.

And yeah. It looks goofy to have a leading slash on your images and subdirectories, but I assure you this is how things work. So long as your images and subdirectories are in the media/import folder, you’ll be fine.

Finally, let’s import those products!

Log into your admin interface. Simple.

Navigate over to System -> Import/Export -> Dataflow – Advanced Profiles

Here’s where things get tricky.

If you have an Import profile, awesome. Skip this next bit (we’ll continue at the next big bold header — Choose your file):

You’ll need to add an import profile. Simple enough.

Name it whatever you’d like, then in the action XML add this:

  1. <var>file</var>
  2. <var>var/import</var>
  3. <var>&lt; ![CDATA[my_products.csv]]&gt;</var>
  4. <var>&lt; ![CDATA[csv]]&gt;</var>
  5. <var>&lt; ![CDATA[,]]&gt;</var>
  6. <var>&lt; ![CDATA[“]]&gt;</var>
  7. <var>true</var>
  8. <var>&lt; ![CDATA[0]]&gt;</var>
  9. <var>1</var>
  10. <var>&lt; ![CDATA[2]]&gt;</var>
  11. <var>&lt; ![CDATA[true]]&gt;</var>
  12. <var>&lt; ![CDATA[true]]&gt;</var>
  13. <var>&lt; ![CDATA[false]]&gt;</var>
  14. <var>&lt; ![CDATA[false]]&gt;</var>
  15. <var>&lt; ![CDATA[true]]&gt;</var>
  16. <var>&lt; ![CDATA[false]]&gt;</var>
  17. <var>&lt; ![CDATA[.]]&gt;</var>
  18. <var>catalog/convert_adapter_productimport</var>
  19. <var>parse</var>

Now, note the line that reads:

  1. <var>&lt; ![CDATA[my_products.csv]]&gt;</var>

Change the ‘my_products.csv’ to whatever you’re calling your CSV file.

Now, you’ll need to upload your csv to var/import via FTP/SFTP/whatever.

  • If the import folder doesn’t exist, create it. Just like earlier, you need to name it like this.

Once you have that set, jump back to your browser click the Save and Continue button.

After the page reloads, choose the Run Profile tab. Then click the Run Profile in Popup button.

AND BAM!

You’re done. Any errors you get… well, I would check with the Magento Forums and/orStackOverflow.

Русский: Импорт производителей и других справо...
Русский: Импорт производителей и других справочников посредством Magento DataFlow (Photo credit: Wikipedia)
Advertisements

One thought on “How to import products to magento using maento’s advanced data profile product import

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s