We have a lot of different products with different attributes we want to show below the product in the grid view.
What is the best approach in order to show the specs below when you have a lot of different attributes and every category has different attributes to show.
<?php
$attr_levensduur = $_product->getAttributeText('levensduur');
$attr_formaat_bodembedekker = $_product->getAttributeText('formaat_bodembedekker');
$attr_kubischemeter = $_product->getAttributeText('kubischemeter');
$attr_aswaarde = $_product->getAttributeText('aswaarde');
$attr_warmtewaarde = $_product->getAttributeText('warmtewaarde');
$attr_houtsoort = $_product->getAttributeText('houtsoort');
?>
<?php if ($attr_levensduur || $attr_formaat_bodembedekker || $attr_kubischemeter || $attr_aswaarde || $attr_warmtewaarde || $attr_houtsoort) : ?>
<ul class="specs-list list-unstyled">
<?php if (!empty ($attr_levensduur)) : ?>
<li class="small"><?php echo $attr_levensduur; ?></li>
<?php endif; ?>
<?php if (!empty ($attr_formaat_bodembedekker)) : ?>
<li class="small"><?php echo $attr_formaat_bodembedekker; ?></li>
<?php endif; ?>
<?php if (!empty ($attr_kubischemeter)) : ?>
<li class="small"><?php echo $attr_kubischemeter; ?></li>
<?php endif; ?>
<?php if (!empty ($attr_aswaarde)) : ?>
<li class="small"><?php echo $attr_aswaarde; ?></li>
<?php endif; ?>
<?php if (!empty ($attr_warmtewaarde)) : ?>
<li class="small"><?php echo $attr_warmtewaarde; ?></li>
<?php endif; ?>
<?php if (!empty ($attr_houtsoort)) : ?>
<li class="small"><?php echo $attr_houtsoort; ?></li>
<?php endif; ?>
</ul>
<?php endif; ?>
When we have for example 50 different attributes this approach is not the best one i guess.
See the image below for an example