3

I used Ubertheme migration tool to migration of data from Magento 1 to magento2. Migration is done successfully, but after that, I face one issue.

Product Image shows in category list page on frontside and product grid in admin side. When I open product detail page in front and admin side, I am not able to see product image.

Can anyone tell me what should I do?

8
  • Try to inspect element using fiebug & check for image URL & try to open
    – Jackson
    Oct 20, 2016 at 10:36
  • @AnkitShah it show default placehoder url in both places. Oct 20, 2016 at 10:38
  • R u able to open image? Image path is correct?
    – Jackson
    Oct 21, 2016 at 1:59
  • @AnkitShah Image is properly display in category page and admin grid, if i copy that url then it also open in browser as well. Oct 21, 2016 at 2:56
  • Try to add new simple product from admin & check on frontend for detail page. Check .htaccess as well
    – Jackson
    Oct 21, 2016 at 3:06

3 Answers 3

2

I found solution using this script,

In above condition, product image are already assign in database but not show in frontend, you can do this using this script.

You need to do following things,

  1. Create one file in magento root directories, let say file name is "Productimage.php"

  2. Put the following code into that file,

    <?php 
    use Magento\Framework\App\Bootstrap;
    require __DIR__ . '/app/bootstrap.php';
    
    $bootstrap = Bootstrap::create(BP, $_SERVER);
    
    $obj = $bootstrap->getObjectManager();
    
    $state = $obj->get('Magento\Framework\App\State');
    $state->setAreaCode('frontend');
    
    try
    {
    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $importDir = __DIR__ . '/pub/media/catalog/product';
        $product = $objectManager->get('Magento\Catalog\Model\Product')->load(YOURPRODUCTID);
    
            if($product->getImage() != '')
            {
                $id = $product->getId();
                $url = $importDir . $product->getImage();
                $product->addImageToMediaGallery($url, array('image', 'small_image', 'thumbnail'), true, false);
                $product->save();
                echo "<br /><br /> $id Product Save Succefully";
            }
    
    }
    catch(\Exception $e)
    {
        echo $e->getMessage();
        exit;
    }
    

NOTE: replace YOURPRODUCTID with your real Id.

1

We wonder which migration tool you referred to. We have old script on Github which is no longer maintained and replaced with a newer version UB Data Migration.

The issue you mentioned might occur with the old script, but not our latest migration tool V3.

3
  • Thanks for your answer, but I found solution and I already posted answer above. Dec 9, 2016 at 9:28
  • Our old script on Github was developed long ago, since the initial release of Magento 2 which might come with unexpected issue.
    – Ubertheme
    Dec 9, 2016 at 10:13
  • That's why we refer to our newer version. Anyway, glad that you figured it out at your end.
    – Ubertheme
    Dec 9, 2016 at 10:14
0
-> Give permissions to pub/media folder chmod 777 -R pub/media/
-> bin/magento c:c
-> bin/magento c:f

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.