[EC-CUBE]サイドバーの商品カテゴリーで、特定のカテゴリーを非表示にする(2.13)

data/Smarty/templates/default/frontparts/bloc/category_tree_fork.tplを編集

ハイライトの行を追加(数字はカテゴリーID)

[php highlight=”3,17″]
<!–{foreach from=$children item=child}–>

<!–{if $child.category_id != 1}–>
<li class="level<!–{$child.level}–><!–{if in_array($child.category_id, $tpl_category_id)}–> onmark active<!–{/if}–>">
<a href="<!–{$smarty.const.ROOT_URLPATH}–>products/list.php?category_id=<!–{$child.category_id}–>"<!–{if in_array($child.category_id, $tpl_category_id)}–> class="onlink"<!–{/if}–>>
<!–{$child.category_name|h}–><span class="badge pull-right"><!–{$child.product_count|default:0}–></span></a>

<!–{if in_array($child.category_id, $arrParentID)}–>
<!–{assign var=disp_child value=1}–>
<!–{else}–>
<!–{assign var=disp_child value=0}–>
<!–{/if}–>
<!–{if isset($child.children|smarty:nodefaults)}–>
<!–{include file="`$smarty.const.TEMPLATE_REALDIR`frontparts/bloc/category_tree_fork.tpl" children=$child.children display=$disp_child}–>
<!–{/if}–>
</li>
<!–{/if}–>

<!–{/foreach}–>
[/php]

複数のカテゴリーを非表示にする

「&&」でつないで記述

[php highlight=”3,17″]
<!–{foreach from=$children item=child}–>

<!–{if $child.category_id != 1 && $child.category_id != 2 }–>
<li class="level<!–{$child.level}–><!–{if in_array($child.category_id, $tpl_category_id)}–> onmark active<!–{/if}–>">
<a href="<!–{$smarty.const.ROOT_URLPATH}–>products/list.php?category_id=<!–{$child.category_id}–>"<!–{if in_array($child.category_id, $tpl_category_id)}–> class="onlink"<!–{/if}–>>
<!–{$child.category_name|h}–><span class="badge pull-right"><!–{$child.product_count|default:0}–></span></a>

<!–{if in_array($child.category_id, $arrParentID)}–>
<!–{assign var=disp_child value=1}–>
<!–{else}–>
<!–{assign var=disp_child value=0}–>
<!–{/if}–>
<!–{if isset($child.children|smarty:nodefaults)}–>
<!–{include file="`$smarty.const.TEMPLATE_REALDIR`frontparts/bloc/category_tree_fork.tpl" children=$child.children display=$disp_child}–>
<!–{/if}–>
</li>
<!–{/if}–>

<!–{/foreach}–>
[/php]