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


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): ?>
  • Use this code also $_product->getData('attribute_code_here'); Feb 26 '16 at 9:18

This should give you what you need


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.

  • it does not give any output , metal is multiselect dropdown attribute , and using this code on product listing page
    – mcoder
    Feb 26 '16 at 9:54
  • but does $_product->getMetal() output something?
    – Marius
    Feb 26 '16 at 9:55
  • no but $_product->getPrice() and weight works fine
    – mcoder
    Feb 26 '16 at 9:59
  • in this case, it depends on the context. If $_product comes from a product collection, maybe the attribute metal is not added to the collection. You should add more info in your question. Provide the context that uses this.
    – Marius
    Feb 26 '16 at 10:00
  • 1
    added that code is used on product listing page
    – mcoder
    Feb 26 '16 at 10:03

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.