1

我有一个关于 CS Cart / Smarty 的项目,我想在活动类别下的类别列表中生成一个类别的产品列表。

到目前为止,代码categories_tree.tpl仅打印类别,如下所示:

{* $Id$ *}
{assign var="cc_id" value=$smarty.request.category_id|default:$smarty.session.current_category_id}
{foreach from=$categories item=category key=cat_key name="categories"}
    {if $category.level == "0"}
        {if $ul_subcategories == "started"}
            </ul>
            {assign var="ul_subcategories" value=""}
        {/if}
        <ul class="menu-root-categories tree">
            <li>
                <a href="{"categories.view?category_id=`$category.category_id`"|fn_url}" {if $category.category_id == $cc_id} class="active"{/if}>{$category.category}</a>
            </li>
        </ul>
    {else}
        {if $ul_subcategories != "started"}
            <ul class="menu-subcategories">
                {assign var="ul_subcategories" value="started"}
        {/if}
        <li><a href="{"categories.view?category_id=`$category.category_id`"|fn_url}"{if $category.category_id == $cc_id} class="active"{/if}>{$category.category}</a></li>

        {if $category.category_id == $cc_id}
            <div class = "cat_prod" style = "display: none;">
                testing
            </div>
        {/if}
    {/if}

    {if $smarty.foreach.categories.last && $ul_subcategories == "started"}
        </ul>
    {/if}
{/foreach}

我需要在div中创建一个<ul>活动类别的产品。cat_prod我如何撰写foreach才能获得该类别的产品?

4

0 回答 0