php - Prestashop 1.6 / Thirtybees: how to call a feature to Product.tpl?
Solution:
To do this, you need a test on the feature value:
{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}
Regards
Answer
Solution:
The ethercreation answer led me to this - the last post on https://archive.is/mgMgW : or here Then I found that both work - thanks! It turns-out there's a limit to smarty {if...else...} loops which I have to learn about, but for putting tags round one line the idea works for me. With formatting, to replace part of a Thirtybees product.tpl file:
{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}
Source