When migrating VirtueMart products to Magento, Vm2Mage also offers the ability to migrate product-images. Because this involves more than just a simple data-transfer, you could run into problems. This document helps you through the neccessary steps to troubleshoot this.

How image migration works

When Vm2Mage transfers data from VirtueMart to Magento, an API client from within Joomla! builds up an HTTP-connection to Magento and through this API-connection, various types of data are transferred. But images are not transferred through this API-connection. Instead, for every product that is migrated, Vm2Mage within Magento tries to copy or download the image from the original VirtueMart website: It first tries to copy files directly from the original VirtueMart image-folder. If this fails, the second method is to download the images from the original VirtueMart website by using the image-URL.

If a product has 10 images included, Magento will try to copy each single one of these images and save them within the Magento import-folder. Once the image is placed within the Magento import-folder, Vm2Mage will pick it up and configure the images for the corresponding Magento product. If the images are either corrupted or not readable, the images will not be added correctly to the Magento product.

Disable PHP open_basedir

The first method of Vm2Mage to fetch the right image, is to copy the original image directly from the original VirtueMart image-folder. This of course only works if both Joomla! as Magento live on the same physcial server, and if Magento has full read-access to the Joomla! folders. For this to work, it's best to disable PHP open_basedir. Also make sure that - if your webserver is using different UNIX-users for web-access - the UNIX-user used by Magento is allowed to read files from the UNIX-user used by Joomla!.

Enable PHP allow_url_fopen

For the image-download to work, you need to have the PHP-option allow_url_fopen enabled. Either modify the php.ini file of your hosting environment, or contact the system administrator to do so. Vm2Mage does not use CURL for this transfer, only allow_url_fopen.

Make sure the VirtueMart website is accessible for Magento

Because Magento needs to download the product-image through URL, you need to make sure Magento can actually access VirtueMart over HTTP. Make sure the firewall is not blocking requests from Magento to Joomla! (or internally within the webserver). Also make sure the hostname of VirtueMart can be resolved from within Magento - make sure the DNS-record (or /etc/hosts entry) is intact and working.

Does the VirtueMart image-folder exist?

Vm2Mage assumes all product-images are stored in the Joomla! folder components/com_virtuemart/shop_image/product/. If more folders need to be searched, just post this as a feature request on the Yireo Forum.

Does the Magento import-folder exist?

Make sure the Magento folder media/import exists and is writable to the webserver. If something fails, it might also be that images are correctly downloaded to this import-folder but uploading them to the product fails - in this case, the temporary image will still be present in this folder: Check to make sure that it is in fact an image (and not some HTML error-document for instance).

Check the Vm2Mage log

If this doesn't provide you clues, make sure to check the Vm2Mage log - located in either /tmp/vm2mage.log or the Magento folder var/log/vm2mage.log. This will probably show errors if both methods (copying or downloading) fail.

Posted on April 8, 2011

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

Upcoming events

Oct
28
Oct
31
LIEF Amsterdam

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.