0

I want to add product images from external url.. I have created CSV file for image uploading..When I click run profile popup button it displays "image not exist" error..http://intow.co/admin/backEnd/uploads/4717602016_05_12_03_28_35pm.png(image url)

3

Using Magento's default Import or Dataflow Import doesn't allow you to download and assign an image via a CSV import. You'll either have to download the image and upload it to the server with the correct path in your CSV or you can look at a 3rd party tool like Magmi for importation.

Magmi's documentation is fairly solid and will allow you to download and assign a product an image via a CSV import.

Magmi's Documentation can be found here - http://wiki.magmi.org/index.php?title=Main_Page

I would also ensure that the link you're providing the image field is valid and displays the image when you access it in a browser, the one you have provided displays a page error/404.

0

Suppose say we have a csv with an extra field: external_image_url for product import.

1> Copy app/code/core/Mage/Catalog/Model/Convert/Adapter/Product.php to the local code pool so that new path looks like: app/code/local/Mage/Catalog/Model/Convert/Adapter/Product.php

2> Open the Product.php from local code pool and search for the following code within saveRow() function:

foreach ($imageData as $file => $fields) {
    try {
        $product->addImageToMediaGallery(Mage::getBaseDir('media') . DS . 'import' . trim($file), $fields);
    }
    catch (Exception $e) {}
}

Add the following code just below it:

/** EXTERNAL IMAGE IMPORT - START **/
$image_url  = $importData['external_image_url']; //get external image url from csv
$image_type = substr(strrchr($image_url,"."),1); //find the image extension
$filename   = md5($image_url . $importData['sku']).'.'.$image_type; //give a new name, you can modify as per your requirement
$filepath   = Mage::getBaseDir('media') . DS . 'import'. DS . $filename; //path for temp storage folder: ./media/import/
file_put_contents($filepath, file_get_contents(trim($image_url))); //store the image from external url to the temp storage folder
$mediaAttribute = array (
        'thumbnail',
        'small_image',
        'image'
);
/**
 * Add image to media gallery
 *
 * @param string        $file              file path of image in file system
 * @param string|array  $mediaAttribute    code of attribute with type 'media_image',
 *                                         leave blank if image should be only in gallery
 * @param boolean       $move              if true, it will move source file
 * @param boolean       $exclude           mark image as disabled in product page view
 */
$product->addImageToMediaGallery($filepath, $mediaAttribute, false, false);
/** EXTERNAL IMAGE IMPORT - END **/

more info here

reference : here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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