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

  • Is this for product view page? – sv3n Jun 20 '17 at 16:56
  • It's for the product view page and the category page. – n00bly Jun 22 '17 at 13:03
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; ?>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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