Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Remove Uploaded Thumbnails Rate Topic   - - - - -

 
  • sap
  • Junior Member
  • Members
  • Join Date: 03-Oct 09
  • 113 posts

Posted 21 June 2015 - 09:58 AM #1

Over time I had manually uploaded thumbnails on the product detail page in the admin (via csv).

Now I want to remove those and have the cart regenerate thumbs from the main image

However I cannot visit product pages one by one in the admin area to remove the uploaded thumbs. Is there a way to do it via CSV or any other way

Appreciate any advice

 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 22391 posts

Posted 22 June 2015 - 08:56 AM #2

You can add the following code to the index.php file:

$_image_data = db_get_array("SELECT * FROM ?:images_links WHERE object_type = 'product' AND image_id != 0");
foreach ($_image_data as $d) {
    fn_delete_image($d['image_id'], $d['pair_id']);
}

after this line:

require(dirname(__FILE__) . '/init.php');

Save the file and go to the home page. And do not forget to delete the code then

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 1210     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 4025     CS-Cart + YOUPI      USD 1459      Multi-Vendor Ultimate       USD 7500 (6000)


 
  • sap
  • Junior Member
  • Members
  • Join Date: 03-Oct 09
  • 113 posts

Posted 22 June 2015 - 09:17 AM #3

Thanks eCom, appreciate your help

This will work for 4.3.1 right? Thats my current version

Also is there any risk of deleting the detailed image? Should I backup anything?

There are about 8000 products where I want to delete the uploaded thumbnail images\

Thanks again

 
  • sap
  • Junior Member
  • Members
  • Join Date: 03-Oct 09
  • 113 posts

Posted 22 June 2015 - 09:23 AM #4

Thanks eCom, appreciate your help

This will work for 4.3.1 right? Thats my current version

Also is there any risk of deleting the detailed image? Should I backup anything?

There are about 8000 products where I want to delete the uploaded thumbnail images\

Thanks again


I also noticed that there are images for which detailed_id is = 0, these include (object_type = ) a few products, promo images, logo etc

For object_type = product, I will first upload the main image and then run the script you have suggested

For other object_types do I need to do anything?

 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 22391 posts

Posted 22 June 2015 - 09:26 AM #5

Yes, it will work on your version. The "image_id != 0" condition means thumbnails only. If you are in doubt, make full dump (it is allowed from the admin panel)

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 1210     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 4025     CS-Cart + YOUPI      USD 1459      Multi-Vendor Ultimate       USD 7500 (6000)