From d293ae61ccb39164fe4bca35e4c3f260e0b5a24b Mon Sep 17 00:00:00 2001 From: Shagshag Date: Mon, 11 Mar 2013 12:39:22 +0100 Subject: [PATCH] [-] SQL error in Combination::setAttributes If $ids_attribute is empty, it cause SQL error. --- classes/Combination.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/classes/Combination.php b/classes/Combination.php index 78f0a0a66..93cdec7ef 100644 --- a/classes/Combination.php +++ b/classes/Combination.php @@ -134,8 +134,8 @@ class CombinationCore extends ObjectModel public function setAttributes($ids_attribute) { - if ($this->deleteAssociations()) - { + $result = $this->deleteAssociations(); + if ($result && !empty($ids_attribute)) { $sql_values = array(); foreach ($ids_attribute as $value) $sql_values[] = '('.(int)$value.', '.(int)$this->id.')'; @@ -144,10 +144,8 @@ class CombinationCore extends ObjectModel INSERT INTO `'._DB_PREFIX_.'product_attribute_combination` (`id_attribute`, `id_product_attribute`) VALUES '.implode(',', $sql_values) ); - - return $result; } - return false; + return $result; } public function setWsProductOptionValues($values)