访问子子类别、Shopware、Smarty
Access sub sub category, Shopware, Smarty
尝试使用 smarty 解决 Shopware 中子子类别访问的问题,但完全不确定如何解决。也许有人知道。
<!-- THIS WORKS -->
{if $Category.sub}
{foreach $Category.sub as $sub}
<li>
<a href="#">
<span itemprop="name">{$sub.name}</span>
</a>
</li>
{/foreach}
{/if}
<!-- THIS DOESN'T WORK -->
{if $Category.sub.sub}
{foreach $Category.sub.sub as $subsub}
<li>
<a href="#">
<span itemprop="name">{$subsub.name}</span>
</a>
</li>
{/foreach}
{/if}
请检查上面的例子:
{foreach $Category.sub as $categoryItem}
{foreach $categoryItem.sub as $subsub}
<li>
<a href="#">
<span itemprop="name">{$subsub.name}</span>
</a>
</li>
{/foreach}
{/foreach}
高级示例:
{foreach $Category.sub as $number => $categoryItem}
{if $categoryItem.childrenCount}
<ul id="submenu-{$number}" {if $categoryItem.flag}class="is--active"{/if}>
{if $categoryItem.cmsHeadline}
<li class="menu--list-item item--level-1">
<span class="menu--list-item-title">{$categoryItem.cmsHeadline}</span>
</li>
{/if}
{foreach $categoryItem.sub as $subcategory}
{if $subcategory.hideTop}
{continue}
{/if}
{$categoryLink = $subcategory.link}
{if $subcategory.external}
{$categoryLink = $subcategory.external}
{/if}
<li class="menu--list-item item--level-1{if $subcategory.flag} item--is-active{/if}">
<a href="{$categoryLink|escapeHtml}" class="menu--list-item-link" title="{$subcategory.name|escape}">{$subcategory.name}</a>
</li>
{/foreach}
</ul>
{/if}
{/foreach}
尝试使用 smarty 解决 Shopware 中子子类别访问的问题,但完全不确定如何解决。也许有人知道。
<!-- THIS WORKS -->
{if $Category.sub}
{foreach $Category.sub as $sub}
<li>
<a href="#">
<span itemprop="name">{$sub.name}</span>
</a>
</li>
{/foreach}
{/if}
<!-- THIS DOESN'T WORK -->
{if $Category.sub.sub}
{foreach $Category.sub.sub as $subsub}
<li>
<a href="#">
<span itemprop="name">{$subsub.name}</span>
</a>
</li>
{/foreach}
{/if}
请检查上面的例子:
{foreach $Category.sub as $categoryItem}
{foreach $categoryItem.sub as $subsub}
<li>
<a href="#">
<span itemprop="name">{$subsub.name}</span>
</a>
</li>
{/foreach}
{/foreach}
高级示例:
{foreach $Category.sub as $number => $categoryItem}
{if $categoryItem.childrenCount}
<ul id="submenu-{$number}" {if $categoryItem.flag}class="is--active"{/if}>
{if $categoryItem.cmsHeadline}
<li class="menu--list-item item--level-1">
<span class="menu--list-item-title">{$categoryItem.cmsHeadline}</span>
</li>
{/if}
{foreach $categoryItem.sub as $subcategory}
{if $subcategory.hideTop}
{continue}
{/if}
{$categoryLink = $subcategory.link}
{if $subcategory.external}
{$categoryLink = $subcategory.external}
{/if}
<li class="menu--list-item item--level-1{if $subcategory.flag} item--is-active{/if}">
<a href="{$categoryLink|escapeHtml}" class="menu--list-item-link" title="{$subcategory.name|escape}">{$subcategory.name}</a>
</li>
{/foreach}
</ul>
{/if}
{/foreach}