is there a way to prevent this? im on zen cart 1.5.x
is there a way to prevent this? im on zen cart 1.5.x
To my knowledge, the image is not deleted when the associated product is deleted
Zen-Venom Get Bitten
it was deleted in mine, i just tested it using the admin.
The image is deleted when a Product is deleted if that image is not used by another Product ...
About the only way to change this, without customizing the code, would be to change the image on the Product before deleting it with an image you do not care about ... then when the image is deleted it does not matter ...
If you really need the image after deleting the Product, you could always just FTP that image back to the server ...
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
which code should i customize and which part?
To prevent the deletion of a Product from deleting the image(s) for it you would have to edit the file:
/your_secret_admin/includes/functions/general.php
and add the code in RED around line 1362:
Code:function zen_remove_product($product_id, $ptc = 'true') { global $db; $product_image = $db->Execute("select products_image from " . TABLE_PRODUCTS . " where products_id = '" . (int)$product_id . "'"); $duplicate_image = $db->Execute("select count(*) as total from " . TABLE_PRODUCTS . " where products_image = '" . zen_db_input($product_image->fields['products_image']) . "'"); // =============== // =============== CODE CHANGED: TURN OFF DELETION OF IMAGES WHEN PRODUCTS ARE DELETED // =============== if (false && $duplicate_image->fields['total'] < 2 and $product_image->fields['products_image'] != '' && PRODUCTS_IMAGE_NO_IMAGE != substr($product_image->fields['products_image'], strrpos($product_image->fields['products_image'], '/')+1)) {
NOTE: Making this change means the images will NEVER be deleted from the server unless you manually delete them
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
Thanks for the update that this worked for you to prevent Product Images from being deleted from the server when you deleted Products ...
Be sure you do periodic maintenance on the server for images that are no longer needed or they will build up over time ...
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!