I have one multiple select attribute with the name 'recommendations' and I want to get the attribute values in the product list.
I create this code to get values. But now I want to replace i tag with Admin value: <i class="admin value"></i>
and <span><?php echo $_target ?></span>
with Default Store View values. How I can get this values separately?
I need to get Admin value and Default Store View in the same code.
<?php if ($targetValues = $_product->getAttributeText('recommendations')) { ?>
<div class="recommended-title"><?php echo $this->__('recommendations') ?></div>
<?php
if (is_string($targetValues)) {
$targetValues = array($targetValues);
}
foreach($targetValues as $_target) :?>
<ul class="list-inline recommended-logo">
<li>
<i class="<?php echo $_target ?>"></i><span><?php echo $_target ?></span></li>
</ul>
<?php endforeach;
}
?>
Best Answer
Use below code to get multi-select values and then you can foreach loop for each attribute value.