Prestashop 1.6 / Thirtybees:如何将功能调用到 Product.tpl?

Prestashop 1.6 / Thirtybees: how to call a feature to Product.tpl?

https://github.com/thirtybees/niara/blob/master/product.tpl#L552-L559 显示如何将所有相关功能调用到产品模板 - product.tpl 。这是代码:

{if !empty($features)}
{foreach from=$features item=feature}
   {if isset($feature.value)}
       {$feature.name|escape:'html':'UTF-8'}
       {$feature.value|escape:'html':'UTF-8'}
   {/if}
{/foreach}
{/if}

有谁知道我是如何调用 Feature id 33, named Color 的? 我的想法是我可以在它周围放置一些微格式模式代码,这样搜索引擎就可以知道颜色。也许这很棘手,这就是为什么我没有看到其他人这样做的原因,但我们将不胜感激。

为此,您需要对特征值进行测试:

{if !empty($features)}
    {foreach from=$features item=feature}
        {if isset($feature.value)}
            {if $feature.id_feature == 33}
                {$feature.name|escape:'html':'UTF-8'}
                <span itemprop="color">{$feature.value|escape:'html':'UTF-8'}</span>
            {else}          
                {$feature.name|escape:'html':'UTF-8'}
                {$feature.value|escape:'html':'UTF-8'}
            {/if}
        {/if}      
    {/foreach}
{/if}

此致

ethercreation 的答案让我想到了这个 - https://archive.is/mgMgW : or here 上的最后一个 post 然后我发现两者都有效 - 谢谢!事实证明,我必须了解 smarty {if...else...} 循环的限制,但对于将标签放在一行中,这个想法对我有用。通过格式化,替换 Thirtybees product.tpl 文件的一部分:

    {if !empty($features)}
    <section id="product-features" class="page-product-box">
    <h3 class="page-product-heading">{l s='Data sheet'}</h3>
    <div class="table-responsive">
    <table 
    class="table 
    table-bordered 
    table-condensed 
    table-hover 
    table-data-sheet">
    {foreach from=$features key=id_feature item=feature}
        {if isset($feature.value)== 33}
              <tr>
                <td>
                    {$feature.name|escape:'html':'UTF-8'}
                </td>
                <td>
                   <span itemprop="color"> 
                    {$feature.value|escape:'html':'UTF-8'}
                   </span>
                 </td>
               </tr>
        {else}
              <tr>
                <td>
                    {$feature.name|escape:'html':'UTF-8'}
                </td>
                <td>
                    {$feature.value|escape:'html':'UTF-8'}
                 </td>
              </tr>
        {/if}
    {/foreach}
    </table>
    </div>
    </section>
    {/if}