// Improve attributes ergonomy with multishop #PSTEST-780
This commit is contained in:
@@ -64,4 +64,20 @@
|
|||||||
displayColorFieldsOption();
|
displayColorFieldsOption();
|
||||||
|
|
||||||
$('#id_attribute_group').change(displayColorFieldsOption);
|
$('#id_attribute_group').change(displayColorFieldsOption);
|
||||||
|
|
||||||
|
var shop_associations = {$fields[0]['form']['shop_associations']};
|
||||||
|
var changeAssociationGroup = function()
|
||||||
|
{
|
||||||
|
var id_attribute_group = $('#id_attribute_group').val();
|
||||||
|
$('.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]))
|
||||||
|
$(item).attr('disabled', false);
|
||||||
|
else
|
||||||
|
$(item).attr('disabled', true);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
$('#id_attribute_group').change(changeAssociationGroup);
|
||||||
|
changeAssociationGroup();
|
||||||
{/block}
|
{/block}
|
||||||
|
|||||||
@@ -255,7 +255,7 @@ class AdminAttributesGroupsControllerCore extends AdminController
|
|||||||
$this->fields_form = array(
|
$this->fields_form = array(
|
||||||
'legend' => array(
|
'legend' => array(
|
||||||
'title' => $this->l('Values'),
|
'title' => $this->l('Values'),
|
||||||
'image' => '../img/admin/asterisk.gif'
|
'image' => '../img/admin/asterisk.gif',
|
||||||
),
|
),
|
||||||
'input' => array(
|
'input' => array(
|
||||||
array(
|
array(
|
||||||
@@ -284,6 +284,14 @@ class AdminAttributesGroupsControllerCore extends AdminController
|
|||||||
|
|
||||||
if (Shop::isFeatureActive())
|
if (Shop::isFeatureActive())
|
||||||
{
|
{
|
||||||
|
// We get all associated shops for all attribute groups, because we will disable group shops
|
||||||
|
// for attributes that the selected attribute group don't support
|
||||||
|
$sql = 'SELECT id_attribute_group, id_group_shop FROM '._DB_PREFIX_.'attribute_group_group_shop';
|
||||||
|
$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(
|
$this->fields_form['input'][] = array(
|
||||||
'type' => 'group_shop',
|
'type' => 'group_shop',
|
||||||
'label' => $this->l('Group Shop association:'),
|
'label' => $this->l('Group Shop association:'),
|
||||||
|
|||||||
Reference in New Issue
Block a user