$product->getAttributeText('att_code'); not working when there is only one value for dropdown,multiselect attribute.

I am having a very strange problem in fetching multiselect option value on the frontend when there is only one option is selected for multiselect attribute.

Let's take an example i have a multiselect attribute "color_section" when i select two values from admin panel for any product it starts showing on frontend using $product->getAttributeText('color_section'); but when i select single value it doesn't give anything.

Please answer if anyone have gone through this.

Thanks in advance.

  • I guess getAttributeTex is a typo? Commented Mar 7, 2014 at 11:08

1 Answer 1


getAttributeText() is able to give you all the labels for a field, the "problem" is, that if only one field is chosen, it returns a string, if more than one field is chosen it returns an array of strings.

So you have to check whether it is an array or a string and process it.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.