Get Multi-Select Attribute Values Without Commas in Magento 1.9

magento-1.9product-attribute

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?

Best Answer

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);