I have imported 7000 products through an Oscommerce website everything is great except that the imported images are not selected as base image , small image and thumbnail image.
I need to inform you that every product have a single image which will act as base image , small image and thumbnail image.
I am not getting how to do that as it's not possible for me to go to every product and mark the image as base image , small image and thumbnail image.
I have created a script and trying to run it is not giving any error but still not solving the issue.
<?php
require 'app/Mage.php';
Mage::app();
$prod_id = 7068 ;
$_product = Mage::getModel('catalog/product')->load($prod_id);
$prod_img_col = $_product->getMediaGalleryImages();
foreach($prod_img_col as $gallery_img) {
$_product->addImageToMediaGallery(Mage::getBaseDir('media') . DS . 'catalog' . DS . 'product'. $gallery_img['file'], array('image', 'thumbnail', 'small_image'), false, false);
}
?>
I hope anyone knows how to do this.
Thanks, Sarvagya