1

I have accidentally deleted all product from Magento store (1100 items) but few minutes before that I did export all of them to the .csv file what let me to import them back but unfortunately there no single image back.

Is there a way to assign all these images back? I assume images are still in media/product? I have access to MySQL but how to prepare SQL query to reassign those images? I don't have fresh enough backup and this is a live store so I'm quite desperate.

Thank you.

2
  • put all of your picture in media/import before import Nov 22, 2017 at 21:24
  • path to the images in exported CSV file is /[first_letter]/[second_letter]/image_name.png but in /media/product/ images are stored in [xxx]/image_name.png so coping them all to /media/import/ will fail to reassing them.
    – makey
    Nov 23, 2017 at 10:41

1 Answer 1

0

If the image columns are in your CSV. All you have to do is place the product images from media/catalog/product under media/import and re-import your CSV. It will then detect and assign them. Make sure that the paths in your CSV match what's below media/import. There's plenty of documentation on this.

Make sure to never mess with your production database ever again. If you're uncertain of what can go wrong, It's a small effort to make a backup of your MySQL database first. If you ever have to do something tricky with your production database again, make sure to have a running copy next to it. This way, if something goes wrong, you only have to swap the database name in your local.xml and clear your cache. Though working in production is not advised, if you have to do it, make sure you have a plan B.

2
  • I wasn't messing with database, I have just clicked [select all] thinking will select only visible ones instead of all in catalog before deleting.
    – makey
    Nov 23, 2017 at 10:34
  • path to the images in exported CSV file is /[first_letter]/[second_letter]/image_name.png but in /media/product/ images are stored in [xxx]/image_name.png so coping them all to /media/import/ will fail to reassing them. P.S. I have managed to recover dump of database with just catalog_* tables.
    – makey
    Nov 23, 2017 at 10:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.