skip to Main Content

I had imported my old oscommerce site with 15000 produts for magento!

But unfortably, the thumbnails are dont defined automatically

http://imgur.com/cNdXd

i can do maually, but 15000 produts is a larg number and i need sped a big amout of time for do it

if anywone can give-me a mysql command to set the first produts image as Base Image, Small Image and Thumbnail will be awesome

thanks

3

Answers


  1. Try update them via api:

    $proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
    $sessionId = $proxy->login('apiUser', 'apiKey');
    
    $products = $proxy->call($sessionId, 'product.list');
    
    foreach ($products as $product) {
        $images = $proxy->call($sessionId, 'product_media.list', $product['sku'])
    
        $imageFilename = $images[0]['file'];
    
        $proxy->call($sessionId, 'product_media.update', array(
            $product['sku'],
            $imageFilename,
            array('types' => array('image', 'thumbnail')
        ));
    }
    

    Related documentation links:
    http://www.magentocommerce.com/wiki/doc/webservices-api/api/catalog_product_attribute_media

    http://www.magentocommerce.com/wiki/doc/webservices-api/api/catalog_product#catalog_product.list

    Login or Signup to reply.
  2. Im having a problem with this SQL code i got somewhere which is supposed to set your first image as image, small image and thumbnail:

    UPDATE catalog_product_entity_media_gallery AS mg,
        catalog_product_entity_media_gallery_value AS mgv,
        catalog_product_entity_varchar AS ev
    SET ev.value = mg.value
    WHERE  mg.value_id = mgv.value_id
        AND mg.entity_id = ev.entity_id
        AND ev.attribute_code IN ('image', 'small_image', 'thumbnail')
        AND mgv.position = 1;
    

    Doesn’t change any rows…

    Also, my attribute_id’s for image, small_image, thumbnail and media_gallery in Magento CE v1.6.2 are 106,109,493,703 using EMSupermarket template.

    The following code also does nothing:

    UPDATE catalog_product_entity_media_gallery AS mg,
        catalog_product_entity_media_gallery_value AS mgv,
        catalog_product_entity_varchar AS ev
    SET ev.value = mg.value
    WHERE  mg.value_id = mgv.value_id
        AND mg.entity_id = ev.entity_id
        AND ev.attribute_id IN (106,109,493)
        AND mgv.position = 1;
    

    Anyone how to do this correctly with my id’s?

    What happened with my oscommerce product import was that the imported product images only end up under the field name media_image, but not image, small_image or thumbnail so i want to copy the media_image values over to the other 3, any ideas how to do this?

    Login or Signup to reply.
  3. I had the same problem. I found this page and ran that SQL command, and also did not get any results. But I modified it to work for me. Here is what I did.

    First of all, I changed line 7 from:
    AND ev.attribute_code IN (‘image’, ‘small_image’, ‘thumbnail’)
    to
    AND ev.attribute_ID = ’74’

    the 74 is my unique attribute id for ‘image’. You will have a different number here. You find it by looking it up in mySQL…
    75 was for ‘small_image’ and 76 for ‘thumbnail’.

    So I ran this code 3 times, 1 for each of those attribute number. Each time I change line 7 ev.attribute_ID = ’75’ :

    UPDATE catalog_product_entity_media_gallery AS mg,
        catalog_product_entity_media_gallery_value AS mgv,
        catalog_product_entity_varchar AS ev
    SET ev.value = mg.value
    WHERE  mg.value_id = mgv.value_id
        AND mg.entity_id = ev.entity_id
        AND ev.attribute_ID = '76'
        AND mgv.position = 1;
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search