// add condition isProductFieldUpdated to product and category association

This commit is contained in:
vChabot committed 2012-04-20 15:26:41 +00:00
1 parent 02a35a960f
commit 5ad963ae19
1 file changed
+2 -2
@@ -1455,7 +1455,7 @@ class AdminProductsControllerCore extends AdminController
if (empty($this->errors)) if (empty($this->errors))
{ {
$languages = Language::getLanguages(false); $languages = Language::getLanguages(false);
if (!$this->object->updateCategories(Tools::getValue('categoryBox'))) if ($this->isProductFieldUpdated('category_box') && !$this->object->updateCategories(Tools::getValue('categoryBox')))
$this->errors[] = Tools::displayError('An error occurred while linking object.').' <b>'.$this->table.'</b> '.Tools::displayError('To categories'); $this->errors[] = Tools::displayError('An error occurred while linking object.').' <b>'.$this->table.'</b> '.Tools::displayError('To categories');
elseif (!$this->updateTags($languages, $this->object)) elseif (!$this->updateTags($languages, $this->object))
$this->errors[] = Tools::displayError('An error occurred while adding tags.'); $this->errors[] = Tools::displayError('An error occurred while adding tags.');
@@ -1580,7 +1580,7 @@ class AdminProductsControllerCore extends AdminController
$this->updateDownloadProduct($object, 1); $this->updateDownloadProduct($object, 1);
$this->updateTags(Language::getLanguages(false), $object); $this->updateTags(Language::getLanguages(false), $object);
if (!$object->updateCategories(Tools::getValue('categoryBox'), true)) if ($this->isProductFieldUpdated('category_box') && !$object->updateCategories(Tools::getValue('categoryBox'), true))
$this->errors[] = Tools::displayError('An error occurred while linking object.').' <b>'.$this->table.'</b> '.Tools::displayError('To categories'); $this->errors[] = Tools::displayError('An error occurred while linking object.').' <b>'.$this->table.'</b> '.Tools::displayError('To categories');
if (empty($this->errors)) if (empty($this->errors))