3

I'm using this to display values of a multi select attribute.

<?php echo $_product->getResource()->getAttribute('attribute_name')->getFrontend()->getValue($_product); ?>

The result is value1, value2, value3

Can someone suggest how to replace the commas with line breaks?

4

There have any function does not exits which is give result like comment with line break in a single code.

You can try the below

$values=explode(',',$_product->getResource()->getAttribute('attribute_name')->getFrontend()->getValue($_product));

$Result=implode(",\n",$values);
| improve this answer | |
  • I get "Array", instead of a list of values. – tlw Jul 30 '15 at 4:38
  • have you tried $Result? – Amit Bera Jul 30 '15 at 4:39
  • Yes! Perfect! (I forgot echo). Thank you so much for the speedy, expert assist! – tlw Jul 30 '15 at 4:47

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.