【问题标题】:display specific category in prestashop tab homepage在 prestashop 选项卡主页中显示特定类别
【发布时间】:2020-01-09 19:43:08
【问题描述】:

我想在 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}

感谢您的帮助

【问题讨论】:

  • 您确定$id_category 已传递给查看吗?尝试回应它。
  • 感谢四个答案@r_a_f 我不知道如何在 tpl 中检查这个
  • 只需在{if $id_category == 114} 下添加{$id_category} 我确定你没有通过它所以你需要检查你的控制器来分配变量(id_category)(smarty.net/docsv2/en/api.assign.tpl
  • 您是否使用类别 114 的产品设置 $new_products

标签: prestashop smarty categories product


【解决方案1】:

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

问候

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-02-04
    • 2021-01-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多