Blog

【ECCUBE2.13】カテゴリをすべて表示する

2015/03/14

ECCUBE2.13

備忘録です

ECCUBEは商品が登録されているカテゴリだけ表示される仕様になっています。
商品が登録されていないカテゴリも全て表示する方法です。

参考サイト
EC-CUBE 2.13以上 カテゴリをすべて表示する(商品数が0でも)

/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Category.php
$this->arrTree = $this->lfGetCatTree($this->tpl_category_id, true);
// ↓
$this->arrTree = $this->lfGetCatTree($this->tpl_category_id, false);
いつでもカテゴリが全表示されるカスタマイズ
/data/Smarty/templates/テンプレート名/frontparts/block/category.tpl
<!--{strip}-->
<div class="block_outer">
<div id="category_area">
<div class="block_body">
<h2><img src="<!--{$TPL_URLPATH}-->img/title/tit_bloc_category.gif" alt="商品カテゴリ" /></h2>
<!--{include file="`$smarty.const.TEMPLATE_REALDIR`frontparts/bloc/category_tree_fork.tpl" children=$arrTree treeID="" display=1 disp_level=2}-->
</div>
</div>
</div>
<!--{/strip}-->

/data/Smarty/templates/テンプレート名/frontparts/block/category_tree_fork.tpl

<!--{strip}-->
<ul <!--{if $treeID != ""}-->id="<!--{$treeID}-->"<!--{/if}--> style="<!--{if !$display}-->display: none;<!--{/if}-->">
<!--{foreach from=$children item=child}-->
<li class="level<!--{$child.level}--><!--{if in_array($child.category_id, $tpl_category_id)}--> onmark<!--{/if}-->">
<p><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}-->(<!--{$child.product_count|default:0}-->)</a></p>
<!--{if $child.level<$disp_level}-->
<!--{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 disp_level=$disp_level}-->
<!--{/if}-->
</li>
<!--{/foreach}-->
</ul>
<!--{/strip}-->

カテゴリー

月間アーカイブ

MORE

ミュージシャンズ・プラザ

神社仏閣ホームーページ制作

ホームページ制作問合せ