What are the steps to import a product with images. I mean - the images, precisely. So I have this code now:
protected function _getImages($product)
{
$importImagesDirectory = Mage::getBaseDir()."/".Mage::getStoreConfig('xmlimport/product/import_images_dir');
if(file_exists($importImagesDirectory))
{
$addImage['sku'] = (string)$product['PK_Produkt'];
$addImage['_media_image'] = $importImagesDirectory . $this->_getPresentationAttributeValue($product, '@Art="Bild" and @Rang="1"');
$addImage['_media_attribute_id'] = Mage::getSingleton('catalog/product')->getResource()->getAttribute('media_gallery')->getAttributeId();
$addImage['_media_is_disabled'] = 0;
$addImage['_media_position'] = 1;
// the following 4 lines are just acquiring string values - the name of the picture
$addImage['_media_lable'] = $this->_getPresentationAttributeValue($product, '@Art="Bild" and @Rang="1"');
$addImage['image'] = $this->_getPresentationAttributeValue($product, '@Art="Bild" and @Rang="1"');;
$addImage['small_image'] = $this->_getPresentationAttributeValue($product, '@Art="Bild" and @Rang="1"');;
$addImage['thumbnail'] = $this->_getPresentationAttributeValue($product, '@Art="Bild" and @Rang="1"');;
}
else Mage::log('Error! Image with name: ' . $importImagesDirectory . ' does not exist! ', null, 'error_image.log', true);
return $addImage;
}
So this array is being merged with the array containing the product information, that is being imported. Now, I was said that the function should also move the images from my media/import/
folder to somewhere catalog/product/
folder, because Magento looks up for images in that folder. Anf if I just import the information, but don't move the images - then no effect (which actually happens right now).
So I am asking, how does that work, is there a function from the API to make this "movement", is that the correct procedure?