我有一个关于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}
我需要在<ul>
div中制作一个cat_prod
活动类别的产品。如何撰写foreach
以获取该类别的产品?