Kategory Tree Datasource¶
Diese Datasource liefert alle Kategorien in einer Baumstruktur
$dataSource = new \Alvine\Application\Platform\Builder\DataSource\Commerce\Catalog\Category\Tree();
Beispiel Template¶
Das Beispiel zeigt eine 4 stufige Navigation, mit links auf eine Gallery Seite.
Mit der Methode suffix wird die URL, mit der CID 371, wie folgt gerendert : /gallery?q=catalogingCategoryCID%3D371
<ul class="uk-nav uk-nav-default uk-nav-parent-icon uk-nav-accordion" data-repeat="category dataset:categories">
<li class="level0" >
<a data-attributes="href dataset:category | index:cid | tostring | suffix:/gallery?q=catalogingCategoryCID%3D" data-replace="dataset:category | index:text | index:name">Haushalt</a>
<ul class="uk-nav-sub" data-condition="exists:children" data-repeat="childlevel1 dataset:category | index:children">
<li class="level1" >
<a data-attributes="href dataset:childlevel1 | index:cid | tostring | suffix:/gallery?q=catalogingCategoryCID%3D" data-replace="dataset:childlevel1 | index:text | index:name" >Waschmaschine</a>
<ul class="uk-nav-sub" data-condition="exists:children" data-repeat="childlevel2 dataset:childlevel1 | index:children">
<li class="level2" >
<a data-attributes="href dataset:childlevel2 | index:cid | tostring | suffix:/gallery?q=catalogingCategoryCID%3D" data-replace="dataset:childlevel2 | index:text | index:name" >-</a>
<ul class="uk-nav-sub" data-condition="exists:children" data-repeat="childlevel3 dataset:childlevel2 | index:children">
<li class="level4" ><a data-attributes="href dataset:childlevel3 | index:cid | tostring | suffix:/gallery?q=catalogingCategoryCID%3D" data-replace="dataset:childlevel3 | index:text | index:name" >-</a>
<ul class="uk-nav-sub" data-condition="exists:children" data-repeat="childlevel4 dataset:childlevel3 | index:children">
<li class="level4" >
<a data-attributes="href dataset:childlevel4 | index:cid | tostring | suffix:/gallery?q=catalogingCategoryCID%3D" data-replace="dataset:childlevel4 | index:text | index:name" >-</a>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>