Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted

Hi all,

 

Reference the Big Images Mod',

 

Please can anyone tell me if there is a way to automatically delete a Big Image (popup) at the time you delete a product in the admin? I know the default image (thumbnail type) is removed, but the Big image stays in the directory and has to be deleted manually. I am planning on setting my site up so that many products(and images) are added and deleted on a daily basis, so this would be very beneficial in time saving!

 

If it's not possible, is there any other applicable mod that might do the job. I've checked Mo-Pics that seems to do the deleting ok, but I don't want multiple images of the same product, just a thumbnail and a seperate enlarged popup image.

 

Any help would be appreciated.

 

Thanks in advance.

 

Adam

Posted

Hi Adam,

 

OK figured it out! :D

 

I also use the 'Big Images' mod - so its a help to me too although my turnaround in images isnt too big!

 

In /admin/functions/general.php, look for this:

 

function tep_remove_product($product_id) {

   $product_image_query = tep_db_query("select products_image from " . TABLE_PRODUCTS . " where products_id = '" . tep_db_input($product_id) . "'");

   

   $product_image = tep_db_fetch_array($product_image_query);



   $duplicate_image_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " where products_image = '" . tep_db_input($product_image['products_image']) . "'");

   $duplicate_image = tep_db_fetch_array($duplicate_image_query);



   if ($duplicate_image['total'] < 2) {

     if (file_exists(DIR_FS_CATALOG_IMAGES . $product_image['products_image'])) {

       @unlink(DIR_FS_CATALOG_IMAGES . $product_image['products_image']);

     }

   }

 

And replace it with this:

 

function tep_remove_product($product_id) {

   $product_image_query = tep_db_query("select products_image from " . TABLE_PRODUCTS . " where products_id = '" . tep_db_input($product_id) . "'");

   

   $product_image = tep_db_fetch_array($product_image_query);



   $duplicate_image_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " where products_image = '" . tep_db_input($product_image['products_image']) . "'");

   $duplicate_image = tep_db_fetch_array($duplicate_image_query);



   if ($duplicate_image['total'] < 2) {

     if (file_exists(DIR_FS_CATALOG_IMAGES . $product_image['products_image'])) {

       @unlink(DIR_FS_CATALOG_IMAGES . $product_image['products_image']);

     }

   }



$product_bimage_query = tep_db_query("select products_bimage from " . TABLE_PRODUCTS . " where products_id = '" . tep_db_input($product_id) . "'");

   

   $product_image = tep_db_fetch_array($product_bimage_query);



   $duplicate_bimage_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " where products_bimage = '" . tep_db_input($product_image['products_bimage']) . "'");

   $duplicate_image = tep_db_fetch_array($duplicate_bimage_query);



   if ($duplicate_bimage['total'] < 2) {

     if (file_exists(DIR_FS_CATALOG_IMAGES . $product_image['products_bimage'])) {

       @unlink(DIR_FS_CATALOG_IMAGES . $product_image['products_bimage']);

     }

   }

 

I haven't tested it fully, so BACKUP!!!!!

 

Let me know how you get on.

 

Cheers

Tony

Posted

Hi Tony,

 

You have solved it for me! :D

 

It appears to be working perfectly from the short test I have done. Thanks very much, I'm sure this will help a lot of people who use the Big Image add-on.

 

Thanks again and all the best!

 

Adam

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...