Question

i want to get attribute value for multi select attribute,

below is code that work if it is just text field or drop down , but for multi select it does not work , please guide way to fix it

$_product->getMetal();

works for text attibute for not for multiselect attibutes.

I am using above code on product listing page.

sample snap from where $_product comes:

<?php foreach ($_productCollection as $_product): ?>
Was it helpful?

Solution

This should give you what you need

$_product->getAttributeText('attribute_code_here');

If you are using this from a collection, make sure the attribute you use is marked as "Used in product listing" and that you rebuilt the indexes.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top