diff --git a/admin-dev/themes/default/template/controllers/attributes/helpers/form/form.tpl b/admin-dev/themes/default/template/controllers/attributes/helpers/form/form.tpl index 177b16734..e4fe5e241 100644 --- a/admin-dev/themes/default/template/controllers/attributes/helpers/form/form.tpl +++ b/admin-dev/themes/default/template/controllers/attributes/helpers/form/form.tpl @@ -52,7 +52,7 @@ {block name="script"} var attributesGroups = {ldelim}{$strAttributesGroups}{rdelim}; - + var displayColorFieldsOption = function() { var val = $('#id_attribute_group').val(); if (attributesGroups[val]) @@ -72,7 +72,7 @@ $('.input_group_shop').each(function(k, item) { var id_group_shop = $(item).val(); - if (shop_associations[id_attribute_group] != 'undefined' && $.inArray(id_group_shop, shop_associations[id_attribute_group]) > -1) + if (typeof shop_associations[id_attribute_group] != 'undefined' && $.inArray(id_group_shop, shop_associations[id_attribute_group]) > -1) $(item).attr('disabled', false); else $(item).attr('disabled', true); diff --git a/controllers/admin/AdminAttributesGroupsController.php b/controllers/admin/AdminAttributesGroupsController.php index 2ff031950..c2a21ef30 100644 --- a/controllers/admin/AdminAttributesGroupsController.php +++ b/controllers/admin/AdminAttributesGroupsController.php @@ -294,7 +294,6 @@ class AdminAttributesGroupsControllerCore extends AdminController $associations = array(); foreach (Db::getInstance()->executeS($sql) as $row) $associations[$row['id_attribute_group']][] = $row['id_group_shop']; - $this->fields_form['shop_associations'] = Tools::jsonEncode($associations); $this->fields_form['input'][] = array( 'type' => 'group_shop', @@ -303,8 +302,10 @@ class AdminAttributesGroupsControllerCore extends AdminController 'values' => Shop::getTree() ); } + else + $associations = array(); - $this->fields_form['shop_associations'] = Tools::jsonEncode(array()); + $this->fields_form['shop_associations'] = Tools::jsonEncode($associations); $this->fields_form['input'][] = array( 'type' => 'color', 'label' => $this->l('Color:'),