显示类别ID的子类别 - Prestashop 1.7

时间:2018-04-10 13:06:12

标签: prestashop smarty prestashop-1.7

我想在prestashop 1.7的主页上显示所有类别的子类别 我创建了这个函数,但它只显示了1个深子子类:

如何从类别ID 231设置forech所有子类别?

$ categories仅显示主要类别,不显示子类别。

    {if isset($categories) AND $categories}
    <div id="subcategories">
        <ul class="clearfix">
            {foreach from=$categories item=subcategory name=homeCategories}<li>
                    <div class="subcategory-image">
                        <a href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'html':'UTF-8'}"
                           title="{$subcategory.name|escape:'html':'UTF-8'}" class="img">
                            {if $subcategory.id_image}
                                <img class="replace-2x"
                                     src="{$link->getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'category_default')|escape:'html':'UTF-8'}"
                                     alt="" width="{$mediumSize.width|escape:'htmlall':'UTF-8'}" height="{$mediumSize.height|escape:'htmlall':'UTF-8'}"/>
                            {else}
                                <img class="replace-2x" src="{$img_cat_dir|escape:'htmlall':'UTF-8'}{$lang_iso|escape:'htmlall':'UTF-8'}-default-medium_default.jpg"
                                     alt="" width="{$mediumSize.width|escape:'htmlall':'UTF-8'}" height="{$mediumSize.height|escape:'htmlall':'UTF-8'}"/>
                            {/if}
                        </a>
                    </div>
                    <h5><a class="subcategory-name"
                           href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'html':'UTF-8'}">{$subcategory.name|truncate:60:'...'|escape:'html':'UTF-8'}</a>
                    </h5>
                </li>{/foreach}
        </ul class="clearfix">
    </div>
{else}
    <p>{l s='No categories' mod='homecategories'}</p>
{/if}

0 个答案:

没有答案