From 8c520c66a32cd17f33c9b5444431d910e35c7eb9 Mon Sep 17 00:00:00 2001 From: tDidierjean Date: Fri, 15 Apr 2011 10:10:23 +0000 Subject: [PATCH] [-] BO : fixed bug #PSCFI-1429 - Deleting products does not remove image files git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@5913 b9a71923-0436-4b27-9f14-aed3839534dd --- admin-dev/tabs/AdminProducts.php | 10 ++++++++-- classes/AdminTab.php | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/admin-dev/tabs/AdminProducts.php b/admin-dev/tabs/AdminProducts.php index ad75530a9..0cc5a3e2a 100644 --- a/admin-dev/tabs/AdminProducts.php +++ b/admin-dev/tabs/AdminProducts.php @@ -45,7 +45,7 @@ class AdminProducts extends AdminTab $this->view = false; $this->duplicate = true; $this->imageType = 'jpg'; - + $this->fieldsDisplay = array( 'id_product' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 20), 'image' => array('title' => $this->l('Photo'), 'align' => 'center', 'image' => 'p', 'width' => 45, 'orderby' => false, 'filter' => false, 'search' => false), @@ -350,7 +350,13 @@ class AdminProducts extends AdminTab $id_category = Tools::getValue('id_category'); $category_url = empty($id_category) ? '' : '&id_category='.$id_category; - $this->deleteImage($object->id); + if ($this->table == 'product') + { + $product = new Product($object->id); + $product->deleteImages(); + }else + $this->deleteImage($object->id); + if ($this->deleted) { $object->deleted = 1; diff --git a/classes/AdminTab.php b/classes/AdminTab.php index 1e04cb99d..de7f2bb57 100644 --- a/classes/AdminTab.php +++ b/classes/AdminTab.php @@ -472,7 +472,7 @@ abstract class AdminTabCore { $dir = null; /* Deleting object images and thumbnails (cache) */ - if (key_exists('dir', $this->fieldImageSettings) AND $this->fieldImageSettings['dir'].'/') + if (key_exists('dir', $this->fieldImageSettings)) { $dir = $this->fieldImageSettings['dir'].'/'; if (file_exists(_PS_IMG_DIR_.$dir.$id.'.'.$this->imageType) AND !unlink(_PS_IMG_DIR_.$dir.$id.'.'.$this->imageType))