1

i'm using the Avs_FastSimpleImport extension to import my products from an csv file. Im building up my product array according to the documentation of the extension, found here

I manage to import the base_image for now. But i have three images (base_image, small_image & thumbnail) and dont find the right solution how to import the other two. According to this, it should be an array, or what:

enter image description here

my code for images, so far:

            '_media_attribute_id'     => !empty($media_attribute_id) ? $media_attribute_id : null,
            '_media_image'            => isset($product['image']) ? $product['image'] : null,
            'image'                   => isset($product['image']) ? $product['image'] : null,
            'small_image'             => isset($product['small_image']) ? $product['small_image'] : null,
            'thumbnail'               => isset($product['thumbnail']) ? $product['thumbnail'] : null,

My Question is how to build up my array to be able to import and set the thumbnail and small_image.

Thanks in advance

1 Answer 1

8

There are two options for this. It's more comfortable to use nested arrays (see http://avstudnitz.github.io/AvS_FastSimpleImport/options.html: "Support Nested Arrays for Import"), you can then use arrays inside the media* attributes like this:

'_media_attribute_id' => array(77, 77, 77), '_media_image' => array('img1.jpg', 'img2.jpg', 'img3.jpg', '_media_is_disabled' => array(1, 0, 0), '_media_position' => array(1, 2, 3), '_media_lable' => array('Image 1', 'Image 2', 'Image 3'),

If you don't want to use nested arrays, you can have seperate arrays for the additional rows per product as described in http://www.integer-net.com/2012/04/04/importing-products-with-the-import-export-interface/. Just don't provide a "sku" value (just nullinstead) for the additional rows.

2
  • thanks, works great but, there is none of the images set as base, thumbnail or small image
    – Florin P.
    Commented Dec 1, 2014 at 14:02
  • after testing a bit around i fixed it by my self. the trick was to set the image, small_image & thumbnail images in addition to the values above: 'media_gallery' => 0, 'image' => isset($product['image']) ? $product['image'] : null, 'small_image' => isset($product['small_image']) ? $product['small_image'] : null, 'thumbnail' => isset($product['thumbnail']) ? $product['thumbnail'] : null,
    – Florin P.
    Commented Dec 1, 2014 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.