0

Does anyone knows how I can check if an option in the multiple selection attribute is selected?

I have a example here:

enter image description here

For each option that is selected I want to show a image on the frontend. If Lupine is selected I want to display lupine.png, if Noten is selected I want to display noten.png and so on.

But I can't figure out how to check which one is selected.

I use the multiple selection attribute because I also want to be able to filter them on the category page.

Regards

2
  • Is this for product view page?
    – sv3n
    Commented Jun 20, 2017 at 16:56
  • It's for the product view page and the category page.
    – n00bly
    Commented Jun 22, 2017 at 13:03

1 Answer 1

1

Hope the code below can be useful for your situation:

<?php $targetValue = explode(",", $_product->getResource()->getAttribute('your_attribute')->getFrontend()->getValue($_product)); ?>

<?php  if(count($targetValue) > 0 ): ?> 
    <label><?php echo $this->__('your_attribute') ?></label>
<?php foreach($targetValues as $key=>$val): ?>
    <!-- your code here -->
<?php endforeach; ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.