Magento - Adding multiple images with a product form csv file?
Asked Answered
N

7

8

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??

Narbada answered 15/2, 2012 at 1:45 Comment(0)
T
3

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.

Terrigenous answered 15/2, 2012 at 23:34 Comment(1)
i export an csv file, why there is no _media_attribute _media_image columns. thank youNarbada
G
2

Here's how to do it with the DataFlow Importer for Magento 1.6.1, got it from here

  1. So you don't edit core files, make a copy of app/code/local/Mage/Catalog/Model/Convert/Adapter/Product.php into app/code/local/Mage/Catalog/Model/Convert/Adapter/
  2. Edit app/code/local/Mage/Catalog/Model/Convert/Adapter/Product.php and add the following after line 799:
  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
Goeger answered 5/9, 2012 at 10:57 Comment(0)
V
1

Not sure if this is still correct, but according to this Magento wiki entry it looks like the default data import does not handle importing gallery images correctly.

You can run the SQL script after each import, as suggested on the wiki page, or you could look at using something like Magmi which, I know from experience, handles gallery images correctly...and faster than the default Magento importer

Vargueno answered 15/2, 2012 at 2:23 Comment(0)
B
0

Can't comment, so had to post a solution...

PCProffit is using an import extension for his solution. More specifically this one: http://www.magentocommerce.com/magento-connect/amartinez-customimportexport.html

As of Magento 1.7.0 I'm having this issue. I have two extensions (Groups2Customers and Advanced Custom Options). Basically the issue is that the media_gallery table isn't being updated correctly when products are imported. CCBlackburn provides a link to the SQL that will update the gallery table (can't upvote with 0 either)...

Magmi will handle this beautifully if you aren't using any extensions that require additional fields to be imported. If you are, you will need to execute the SQL after any imports, or fix the code for the import.

Brainpan answered 2/8, 2012 at 16:41 Comment(0)
I
0

Here's how to do it with the DataFlow Importer for Magento 1.6.1, got it from here

So you don't edit core files, make a copy of app/code/local/Mage/Catalog/Model/Convert/Adapter/Product.php into app/code/local/Mage/Catalog/Model/Convert/Adapter/ Edit app/code/local/Mage/Catalog/Model/Convert/Adapter/Product.php and add the following after line 799:

this things work for me magento 1.7.0.2 thanks for sharing this ans. thanks a lot

Illuminometer answered 18/7, 2014 at 4:48 Comment(0)
A
0

Adding multiple images with a product form csv file you no need to doing any customization in any file this functionality already in magento, for this you need to use "Import/Export" in magento admin for upload product and multiple images update, please see how to we do add multiple images see below point:

1. you need to create csv file for upload products, you will use this

go to admin > system >import/export > export and download csv for using product import.

2. then create you csv like this(Please see attached screen shot) for upload multiple image in one product.

enter image description here

3. go to admin > system >import/export > import check your csv correct or not then import and check you will see in your product all images are add.

if any issue please let me know.

Thanks
Ravi
Accepter answered 15/5, 2015 at 5:47 Comment(0)
M
0

I think you can go with this and can import multiple images

sku | image | small_image | thumbnail

MAN-1 | /Man/3.jpg | /Man/3.jpg | /Man/3.jpg

MAN-1 | /Man/2.jpg | /Man/2.jpg | /Man/2.jpg

MAN-1 | /Man/1.jpg | /Man/1.jpg | /Man/1.jpg

And the image which you will put in last row, will be show as a selected in admin and front-end.

Milksop answered 22/8, 2015 at 9:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.