// Fix default shop associations in helper shop #PSTEST-746

This commit is contained in:
rMalie
2012-02-15 16:43:32 +00:00
parent 7895a7f533
commit 1b9dadf95d
2 changed files with 22 additions and 2 deletions
@@ -82,7 +82,7 @@ function check_all_shop() {
</td>
</tr>
{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}
+20
View File
@@ -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(