[-] BO: Fix of product combinations edition and duplication of combination per shop

This commit is contained in:
rGaillard
2012-08-30 15:03:21 +00:00
parent 4746660bad
commit 9a438dec72
2 changed files with 31 additions and 27 deletions
+11 -3
View File
@@ -987,7 +987,7 @@ class ProductCore extends ObjectModel
return count($result) > 0;
}
public function productAttributeExists($attributes_list, $current_product_attribute = false, Context $context = null)
public function productAttributeExists($attributes_list, $current_product_attribute = false, Context $context = null, $all_shops = false, $return_id = false)
{
if (!Combination::isFeatureActive())
return false;
@@ -998,7 +998,7 @@ class ProductCore extends ObjectModel
FROM `'._DB_PREFIX_.'product_attribute` pa
JOIN `'._DB_PREFIX_.'product_attribute_shop` pas ON (pas.id_product_attribute = pa.id_product_attribute)
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (pac.`id_product_attribute` = pa.`id_product_attribute`)
WHERE pas.id_shop ='.(int)$context->shop->id.' AND pa.`id_product` = '.(int)$this->id
WHERE 1 '.(!$all_shops ? ' AND pas.id_shop ='.(int)$context->shop->id : '').' AND pa.`id_product` = '.(int)$this->id
);
/* If something's wrong */
@@ -1017,9 +1017,17 @@ class ProductCore extends ObjectModel
$diff = false;
for ($i = 0; $diff == false && isset($product_attribute[$i]); $i++)
if (!in_array($product_attribute[$i], $attributes_list) || $key == $current_product_attribute)
$diff = true;
{
if ($return_id)
return $key;
return true;
}
if (!$diff)
{
if ($return_id)
return $key;
return true;
}
}
return false;