After importing products,sometimes you can’t view it’s images of that product.Product images are missing.If already included image names/path of the csv file this is happening.Here simple MySQL Query that will fill the missing records, and which you will need to run each time after importing products with images using CSV.
If you want to know properly import and export products it will describes my another article.
Note:- My Magento version is 188.8.131.52
- Before you must export your images as csv file.You can view it’s format from this link.[download id=”29″]
- Then upload your images into the /media/catalog/product folder.
1-Log into the Magento admin panel and go to the System -> Import/Export -> Dataflow-Profiles.
2-Select Upload File option.Upload your images.csv file and click “Save and Continue Edit” button.
3-Select Run Profile option.Then select that you uploaded csv file.Click “Run Profile in Popup” button.
4-After execution csv file, log into the database of magento. Run the following MySQL Query in the database.
INSERT INTO catalog_product_entity_media_gallery (attribute_id, entity_id, `value`)
SELECT ga.attribute_id, v.entity_id, v.value
FROM catalog_product_entity_varchar v
INNER JOIN eav_entity_type et ON et.entity_type_code='catalog_product'
INNER JOIN eav_attribute va ON va.entity_type_id = et.entity_type_id AND va.frontend_input = 'media_image' AND va.attribute_id = v.attribute_id
INNER JOIN eav_attribute ga ON va.entity_type_id = et.entity_type_id AND ga.attribute_code = 'media_gallery'
LEFT JOIN catalog_product_entity_media_gallery g ON g.entity_id=v.entity_id AND g.value = v.value
WHERE v.value <> 'no_selection' AND v.value <> '' AND g.value IS NULL;
5-Go to the System -> Index Management. Select all check boxes and re-index them.
6-Then go to the products page, open a product -> images, then you can see product images there.
If you don’t see them, clear all cache in the magento admin panel and then see the images.