PrestaShop打印产品列表中的功能

时间:2015-07-31 07:20:27

标签: php html html5 prestashop

我在产品列表中打印功能时遇到一个问题:

{if isset($product.features)}
    <div class="features">
         {foreach from=$product.features item=feature}
                <table class="feature-pl">
                <tr>
                      <td class="fea-name">{$feature.name}</td>
                      <td class="fea-valu">{$feature.value}</td>
                </tr>
                </table>
          {/foreach}
    </div>
{/if}

但是我想只打印其中的两个功能,所以我该怎么做?

1 个答案:

答案 0 :(得分:0)

我知道它不是非常优雅,但你可以这样做:

{if isset($product.features)}
<div class="features">
     {foreach from=$product.features item=feature}
        {if $feature.name eq "Feature1" or $feature.name eq "Feature2" }
            <table class="feature-pl">
            <tr>
                  <td class="fea-name">{$feature.name}</td>
                  <td class="fea-valu">{$feature.value}</td>
            </tr>
            </table>
        {/if}
      {/foreach}
</div>
{/if}