I have a set of products, which are using different image for base, small and thumbnail.
I would like to programmatically update them so that the base/thumbnail image is the same as the image now used for small image.
Any ideas?
you can find out on ths way .
$productId = '1';
$getimage = "SELECT value FROM catalog_product_entity_varchar WHERE entity_id = '$productId' AND store_id = '1' AND attribute_id = '88'"; // where 88 is the attribute id for 'small' in my case .
$imageUrl = $connection->fetchAll($getimage);
$imagePath = $imageUrl[0]['value'];
$sql = "DELETE FROM catalog_product_entity_varchar WHERE `entity_id`='$productId' AND `attribute_id` IN ('87','89')";
$connection->query($sql);
$sql1 = "INSERT INTO catalog_product_entity_varchar (`attribute_id`, `store_id`, `entity_id`, `value`) VALUES ('87','0','$productId','$imagePath'),('87','1','$productId','$imagePath'),('89','0','$productId','$imagePath'),('89','1','$productId','$imagePath')";
87 and 89 are attribute id for base and thumbnail resp.
You can check on catalog_product_entity_varchar
that what are your attribute ids for base,small and thumbnail
Note : Backup your database first, then after do this step.