From 79fda741cd3a5804689aadcbf3e521bf01feac89 Mon Sep 17 00:00:00 2001 From: dMetzger Date: Tue, 14 Aug 2012 08:05:09 +0000 Subject: [PATCH] [-] BO : Attribute deletion fixed #PSCFV-3616 git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@16838 b9a71923-0436-4b27-9f14-aed3839534dd --- classes/Attribute.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/classes/Attribute.php b/classes/Attribute.php index 3f6803021..08e64d94b 100644 --- a/classes/Attribute.php +++ b/classes/Attribute.php @@ -50,7 +50,7 @@ class AttributeCore extends ObjectModel // Lang fields 'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 64), - ), + ) ); @@ -75,13 +75,15 @@ class AttributeCore extends ObjectModel { if (!$this->hasMultishopEntries()) { - $combinations = new Collection('Combination'); - $combinations->where($this->def['primary'], '=', $this->id); - foreach ($combinations as $combination) + $result = Db::getInstance()->executeS('SELECT id_product_attribute FROM '._DB_PREFIX_.'product_attribute_combination WHERE id_attribute = '.(int)$this->id); + foreach ($result as $row) + { + $combination = new Combination($row['id_product_attribute']); $combination->delete(); + } - // Delete associated restrictions on cart rules - CartRule::cleanProductRuleIntegrity('attributes', $this->id); + // Delete associated restrictions on cart rules + CartRule::cleanProductRuleIntegrity('attributes', $this->id); /* Reinitializing position */ $this->cleanPositions((int)$this->id_attribute_group);