I need to display multiple product images on details page, so i add i column named gallery
in the csv file. and add some values like this in a box
/hogan/gray1.jpg,/hogan/gray2.jpg,/hogan/gray3.jpg
i put the images into the import/hogan
file. then import the csv file. but there is no display multiple product images on details page.why??
Magento 2 Import Product Images from External Server Upload the images to be imported to the delegated folder on the external server. In the CSV data, enter the full URL for each image file in the right column for image types such as base_image, small_image, thumbnail_image, or additional_images.
The fastest way to import images with CSV product import is to use web upload from public websites or file-sharing services like Dropbox, Google Drive and others. Alternatively, you can upload images directly from the local drive and link them to the product image field in CSV.
I have not used gallery images, but I'm not certain that's what you really want. If you want to import multiple images in a product detail page here's what you need to do with your CSV file.
1) CSV import in Magento assumes your images are in media/import. So all references in your CSV file should be listed from there. For example if your image to import is:
media/import/image1.jpg
then your image needs to be listed in the CSV file as just /image1.jpg (leading slash required).
2) To add 'media images' use the columns: _media_attribute (seems to default to 77, check an export to confirm) _media_image - this is the name of your image file (e.g. /image1.jpg) _media_lable (notice misspelling is NOT a typo) - This is the image label _media_position - ordering of images (e.g. 1, 2, 3, ...) _media_is_disabled - 1 = disabled, 0 = enabled
Enter multiple images then on multiple rows for one product such as:
_media_attribute _media_image _media_lable _media_position _media_is_disabled
77 /image1.jpg Image 1 label 1 0
77 /image2.jpg Image 2 label 2 0
If you want to designate any of these as your default image, small image or thumbnail, then you need to put these same images and labels in the corresponding columns for (image, image_label), (small_image, small_image_label), (thumbnail, thumbnail_label) respectively.
Hope that's helpful.
Here's how to do it with the DataFlow Importer for Magento 1.6.1, got it from here
if (isset($importData['media_gallery']) && !empty($importData['media_gallery'])) { $x = explode(',', $importData['media_gallery']); foreach ($x as $file) { $imagesToAdd[] = array('file' => trim($file)); } $mediaGalleryBackendModel->addImagesWithDifferentMediaAttributes( $product, $imagesToAdd, Mage::getBaseDir('media') . DS . 'import', false, false ); }
...so you end up with this:
793 $addedFilesCorrespondence = $mediaGalleryBackendModel->addImagesWithDifferentMediaAttributes(
794 $product,
795 $arrayToMassAdd, Mage::getBaseDir('media') . DS . 'import',
796 false,
797 false
798 );
799 /* http://www.magentocommerce.com/boards/viewthread/224928/P30/#t403196 */
800 if (isset($importData['media_gallery']) && !empty($importData['media_gallery'])) {
801 $x = explode(',', $importData['media_gallery']);
802 foreach ($x as $file) {
803 $imagesToAdd[] = array('file' => trim($file));
804 }
805
806 $mediaGalleryBackendModel->addImagesWithDifferentMediaAttributes(
807 $product,
808 $imagesToAdd, Mage::getBaseDir('media') . DS . 'import',
809 false,
810 false
811 );
812 }
If your CSV file, add a column called *media_gallery*, and put your other images in /media/import:
media_gallery
-------------
/s/e/second_image.png, /t/h/third_image.png,/f/o/fourth_image.png
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With