首页 > 解决方案 > 在 prestashop 选项卡主页中显示特定类别

问题描述

我想在 prestashop 1.6 主页的新产品选项卡中仅显示来自特定类别的产品

我使用 blocknewproducts_home.tpl

我在下面尝试了此代码,但类别 114 中没有显示任何内容(附有获取产品)

{if $id_category == 114}
    {include file="$tpl_dir./product-list.tpl" products=$new_products class='blocknewproducts tab-pane' id='blocknewproducts'}
{/if}
{if isset($new_products) && $new_products}
    {include file="$tpl_dir./product-list.tpl" products=$new_products class='blocknewproducts tab-pane' id='blocknewproducts'}
{else}
    <ul id="blocknewproducts" class="blocknewproducts tab-pane">
        <li class="alert alert-info">{l s='No new products at this time.' mod='blocknewproducts'}</li>
    </ul>
{/if}

谢谢你的帮助

标签: prestashopsmartycategoriesproduct

解决方案


尝试宽度:{if $smarty.get.id_category == 114}

问候


推荐阅读