diff --git a/admin-dev/themes/default/template/helpers/assoshop.tpl b/admin-dev/themes/default/template/helpers/assoshop.tpl index cf0ad9eb7..73c9c940a 100644 --- a/admin-dev/themes/default/template/helpers/assoshop.tpl +++ b/admin-dev/themes/default/template/helpers/assoshop.tpl @@ -82,7 +82,7 @@ function check_all_shop() { {foreach $input.values as $groupID => $groupData} - {if ($input.type == 'group_shop' && (isset($fields_value.shop[$groupID]) || !$form_id))} + {if ($input.type == 'group_shop' && isset($fields_value.shop[$groupID]))} {assign var=groupChecked value=true} {else} {assign var=groupChecked value=false} @@ -104,7 +104,7 @@ function check_all_shop() { {if $input.type == 'shop'} {assign var=j value=0} {foreach $groupData['shops'] as $shopID => $shopData} - {if (isset($fields_value.shop[$shopID]) || !$form_id)} + {if (isset($fields_value.shop[$shopID]))} {assign var=checked value=true} {else} {assign var=checked value=false} diff --git a/classes/helper/Helper.php b/classes/helper/Helper.php index 9a73e5093..2e9c2660a 100755 --- a/classes/helper/Helper.php +++ b/classes/helper/Helper.php @@ -334,6 +334,26 @@ class HelperCore foreach (Db::getInstance()->executeS($sql) as $row) $assos[$row['id_'.$type]] = $row['id_'.$type]; } + else + { + switch (Context::shop()) + { + case Shop::CONTEXT_SHOP : + $assos[$this->context->shop->id] = $this->context->shop->id; + break; + + case Shop::CONTEXT_GROUP : + foreach (Shop::getShops(false, $this->context->shop->getGroupID(), true) as $id_shop) + $assos[$id_shop] = $id_shop; + break; + + default : + foreach (Shop::getShops(false, null, true) as $id_shop) + $assos[$id_shop] = $id_shop; + break; + } + } + $tpl = $this->createTemplate('helpers/assoshop.tpl'); $tpl->assign(array( 'input' => array(