[-] 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
This commit is contained in:
dMetzger
2012-08-14 08:05:09 +00:00
parent e60df09495
commit 79fda741cd
+8 -6
View File
@@ -50,7 +50,7 @@ class AttributeCore extends ObjectModel
// Lang fields // Lang fields
'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 64), '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()) if (!$this->hasMultishopEntries())
{ {
$combinations = new Collection('Combination'); $result = Db::getInstance()->executeS('SELECT id_product_attribute FROM '._DB_PREFIX_.'product_attribute_combination WHERE id_attribute = '.(int)$this->id);
$combinations->where($this->def['primary'], '=', $this->id); foreach ($result as $row)
foreach ($combinations as $combination) {
$combination = new Combination($row['id_product_attribute']);
$combination->delete(); $combination->delete();
}
// Delete associated restrictions on cart rules // Delete associated restrictions on cart rules
CartRule::cleanProductRuleIntegrity('attributes', $this->id); CartRule::cleanProductRuleIntegrity('attributes', $this->id);
/* Reinitializing position */ /* Reinitializing position */
$this->cleanPositions((int)$this->id_attribute_group); $this->cleanPositions((int)$this->id_attribute_group);