I've created a script to import many hundred products from another datasource via SOAP to magento but I want to use the same product image for all products. Is this possible?
1 Answer
Place your product image at /media/import/folder. and rest code will handle
$client = new SoapClient('http://yourmagentohost.com/index.php/api/v2_soap?wsdl=1');
$session = $client->login('yourapiusername','yourapipassword');
$name = $product->getName()
$download_path = "/home/magento/media/imports/" . $file_name; // path to media/import/
$content = base64_encode(file_get_contents($file));
$newFile = array(
'content' => $content,
'mime' => 'image/jpeg'
);
$client->catalogProductAttributeMediaCreate(
$session, $productId, array('file' => $newFile, 'label' => $name, 'position' => '50', 'types' => array('image', 'small_image', 'thumbnail'), 'exclude' => 0)
);
-
Thanks but with this solution the same image will be upload again for each product, right? is it possible that all of the products have the same img path?– AlexCommented Aug 4, 2016 at 9:54