I have a multi select attribute with some values. I get the values with this code:
<?php $targetValue = explode(",", $_product->getResource()->getAttribute('nf_allergie')->getFrontend()->getValue($_product)); ?>
<?php if(count($targetValue) > 0 ): ?>
<?php foreach($targetValue as $key=>$val): ?>
<div class="<?php echo $key ?>">
<span>
<?php echo $val ?>
</span>
</div>
<br>
<?php endforeach; ?>
<?php endif;?>
For example some values: - Gluten - Mosterd - Noten - Schaaldieren
How can I check if the value is Gluten, then show Gluten.jpg. And if also Mosterd is selected, then show also Mosterg.jpg
How can I achieve such thing?