UPCOMING: Magento 2 Bootcamp of four days in The Netherlands (April 29th - May 2nd)

December 16, 2009

Migrating products using Vm2Mage

Yireo Blog Post

Migrating products is easy with Vm2Mage. You just hit the Migrate button and the AJAX-process is starting to migrate batches of VirtueMart products to Magento. But a product can have dependencies. This tutorial outlines all the steps to safely migrate products.

Before migrating products

When migrating products from VirtueMart to Magento, the assumption is made that all the requirements for the products are met by Magento: For instance, if a product is placed in a category Bridges, this category should already exist in Magento before migrating that product.

Make sure the product dependencies are solved, before migrating the product

With Vm2Mage, things are still working out if you first migrate some products, then create the necessary categories and then migrate the products again. But for a complete migration you will need to have the following things in place before migrating:

  • Categories (through a separate migration-page)
  • Product tax classes (through the parameters)

For the migration of images the Magento folder /media/import needs to be writable.

About product attributes

There are different types of product attributes

A product can have product attributes, but unfortunately there are different ways VirtueMart deals with this. Vm2Mage will migrate data from the MySQL table jos_vm_product_attributes directly into Magento Attributes as they are maintained as separate attributes. The table jos_vm_product_attributes is used by newer versions of VirtueMart, and is actually the clean way to handle product attributes.

But there is a legacy as well. Every product can have its own custom attributes. Vm2Mage will only migrate those attributes to Magento if they already exist within Magento. For instance, if a VirtueMart product uses a Attribute List or a Custom Attribute List which contains an attribute with title or name color, this attribute will only be migrated when the attribute color already exists within Magento.

Creating attributes

The solution is to create all needed attributes first in Magento, before migrating products. If you have common attributes that are defined in VirtueMart for use with multiple products, those attributes are created automatically during product-migration.

Attribute-values however are created on the fly: If you have 10 products with 3 different VirtueMart attributes, each attribute having 10 different attribute-values, you do not need to create the attribute-values themselves.

Converting attribute-labels into attribute-names

Magento has various rules that an attribute-name needs to comply to: In general, no non-alphanumerical characters are allowed. However, when migrating attribute-values from VirtueMart, it might be that the attribute is only identified by a human-readable label and a VirtueMart-only ID. To migrate this attribute anyway, Vm2Mage converts the VirtueMart attribute-label to a Magento attribute-name that is compliant to Magento rules:

  • The label is UTF-8 decoded. This normally does nothing special, unless the VirtueMart database-values are stored with the wrong charset-collasion.
  • Characters like ã are converted to a normal a. Only alphabetical characters from the general western alphabet are allowed.
  • Any non-alphanumerical character that remains is converted into an underscore _.
  • When the attribute-name starts with com_virtuemart_, that prefix is removed.

In practice, it is quite tricky to try to guess which attribute-name results from which attribute-label. The easier way is to open up a specific VirtueMart product within the Vm2Mage backend in Joomla!, debug that product, and see which attribute-name is included in the API-request that is sent to Magento.

About Configurable Products

For Simple Products you can just restart the Vm2Mage product-migration. For Configurable Products, it's better to start fresh - by first removing all products from Magento, and then migrating the products.

Also beware that when you migrate products with children (in VirtueMart referred to as a Parent Product, in Magento called a Configurable Product), the children must be migrated before their parents. When migrating all products at once, this is done automatically, but because you have the freedom to choose which products to migrate when, this warning stands.

Configurable Products is probably the most complicated thing Vm2Mage has to offer. After you have migrated Configurable Products, open them up in the Magento Admin Panel to see if everything migrated successfuly. You might need to set a few extra options (and save the product) to finish the migration.

About Related Products

VirtueMart product-relations are migrated to Related Products in Magento. But for this to work, the SKUs of those related products need to be available in the Magento database. Therefor, the first time when you migrate data using Vm2Mage, some products will be missing their related products. It is advised to run the product-migration at least twice to make sure Vm2Mage is able to link products properly.

Don't change too much while migrating

It is recommended not to change any details that may have a relation to something else, as long as the migration lasts. This involves product pricing, tax-rules, attributes used with Configurable Products, etcetera.

Selecting which products to migrate

Within the Vm2Mage Products Overview-screen you can select products based on their tax-class, based on whether they are a parent or not, or just filtered by their name or SKU. Each time that you make a selection of products and then hit the Migrate button, only that selection of products will be migrated. If you have checked any checkboxes, only those selected products will be migrated. If you check no checkboxes, all products on those pages will be migrated.

Use selections to migrate specific product to different stores or apply different settings

This allows you to phase the migration of products, or test out the migration for a few products before the whole job. Note that because of this flexibility, you are responsible of migrating products in the right order. The main benefit here is that you can migrate products using different Vm2Mage Parameters. But you can also test the migration of a few products, to make sure everything is working, before migrating the lot.

The selection-options not only allow you to filter products, but also sort these orders (for instance by title or by SKU). This sorting is not applied to the product-list when migrating.

Checking upon the result

If you are done with migrating products, and you want to see the result in the frontend, make sure to reindex all indices via Index Management and flush all caches.

Posted on December 16, 2009

About the author

Author Jisse Reitsma

Jisse Reitsma is the founder of Yireo, extension developer, developer trainer and 3x Magento Master. His passion is for technology and open source. And he loves talking as well.

Sponsor Yireo

Looking for a training in-house?

Let's get to it!

We don't write too commercial stuff, we focus on the technology (which we love) and we regularly come up with innovative solutions. Via our newsletter, you can keep yourself up to date on all of this coolness. Subscribing only takes seconds.

Do not miss out on what we say

This will be the most interesting spam you have ever read

We don't write too commercial stuff, we focus on the technology (which we love) and we regularly come up with innovative solutions. Via our newsletter, you can keep yourself up to date on all of this coolness. Subscribing only takes seconds.