1

I'm trying to export magento simple products with gallery images I can only find "image","small_image","thumbnail" in the csv file but I think magento has also gallery field? Why it's not included in my profile? I have checked and I didn't skip it. I also tried to export only gallery field map and it was empty. I'm trying to understand if magento can export also gallery images path? The import is easy, there is many options such as Magmi etc... but how to make magento export those gallery images, The alternatives are expensive extensions for single license (I have 20 websites where I want to export) the unlimited license cost $1,000+ this is crazy. I just want images to be included nothing major. Please help?

3 Answers 3

2

If I understand correctly you are using Magento DataFlow export which is quite outdated.

I suggest using Magento's ImportExport (System\ImportExport\Export). It exports all gallery images into a _media_image column.

1

I think NO, I did not find this option in magento 1.9. I created a php script which will fetch and create csv file with these product images. Put this file in root and run. Change csv header according to your need.

    <?php
error_reporting(E_ALL);
ini_set("memory_limit", "100000M");

require_once('app/Mage.php'); //Path to Magento
umask(0);
Mage::app("default");
Mage::init();

// Set an Admin Session
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
Mage::getSingleton('core/session', array('name' => 'adminhtml'));
$userModel = Mage::getModel('admin/user');
$userModel->setUserId(1);
$session = Mage::getSingleton('admin/session');
$session->setUser($userModel);
$session->setAcl(Mage::getResourceModel('admin/acl')->loadAcl());

$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
$data=array();
$csv_header = array(
   0=> 'SKU*',
   1=> 'Image Alt 01 URL',
   2=>'Image Alt 02 URL',
   3=> 'Image Alt 03 URL',
   4=> 'Image Alt 04 URL',
   5=> 'Image Alt 05 URL',
   6=> 'Image Alt 06 URL',
   7=> 'Image Alt 07 URL',
   8=> 'Image Alt 08 URL',
   9=> 'Image Alt 09 URL',
   10=> 'Image Alt 10 URL',
   11=> 'Image Alt 11 URL',
   12=> 'Image Alt 12 URL',
   13=> 'Image Alt 13 URL',
   14=> 'Image Alt 14 URL',
   15=> 'Image Alt 15 URL',
   16=> 'Image Alt 16 URL',
   17=> 'Image Alt 17 URL',
   18=> 'Image Alt 18 URL',
   19=> 'Image Alt 19 URL',
   20=> 'Image Alt 20 URL'

);
$data[0]=$csv_header;

/* Get orders collection of pending orders, run a query */
$_collection = Mage::getModel('catalog/product')->getCollection()
                ->addAttributeToSelect('*'); // ONLY AS EXAMPLE - DONT SELECT ALL ATTRIBUTES, VERY VERY BAD! 
//$_collection->getSelect()->limit(20);
$products = array();

foreach ($_collection as $key => $_product) {

    $gallery_images = Mage::getModel('catalog/product')->load($_product->getId())->getMediaGalleryImages();
    $items = array();
    $data[$key][0]=$_product->getSku();
    $v=1;
    foreach($gallery_images as  $g_image) {
        $items[] = $g_image['url'];
        $data[$key][$v++]=$g_image['url'];
    }

}



//echo '<pre>';
//print_r($data);


header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="productMediaImages.csv"');

$fp = fopen('php://output', 'wb');
foreach ($data as $line) {
    fputcsv($fp, $line, ',');
}
fclose($fp);
?>
-1

You can use Aten Software's free Product Data Exporter to export all the images (main image, small image, swatch image) plus all gallery images to a CSV file. It was just updated this week to support Magento 2+, and is backward-compatible with Magento 1.x.

Magento 2.x/1.x Export All Images to CSV File Free Script

Gallery images will be exported in the aten_additional_image_url column, as a comma-separated list.

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.