Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong return type for getAttributeText($attributeCode) #11691

Closed
diazwatson opened this issue Oct 24, 2017 · 5 comments
Closed

Wrong return type for getAttributeText($attributeCode) #11691

diazwatson opened this issue Oct 24, 2017 · 5 comments
Assignees
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release

Comments

@diazwatson
Copy link
Contributor

When I pass the a multi-select attribute code to getAttributeText($attributeCode) I get an array instead of an string.

public function getAttributeText($attributeCode)

Actually I don't see anything wrong with it but the return tag should be updated accordingly.

Preconditions

  1. Magento CE 2.1.9 /2.2 with sample data.

Steps to reproduce

I guess the easiest way to reproduce it is by:

  1. Creating a multi-select attribute for a product and add few values.
  2. Add the attribute you just created to the attribute set Default
  3. Edit a product using that attribute set and select all attribute values.
  4. Then you could use (for example)

magento/module-catalog/view/frontend/templates/product/view/form.phtml

to output the attribute values:

print_r($product->getAttributeText('your-attribute-code-here'))

Expected result

I would expect the return to be a string type as the return type says.

Actual result

But the result is instead an array of attribute values.

screen shot 2017-10-24 at 14 40 05

@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Oct 24, 2017
@p-bystritsky p-bystritsky self-assigned this Nov 3, 2017
p-bystritsky added a commit to p-bystritsky/magento2 that referenced this issue Nov 3, 2017
@magento-engcom-team magento-engcom-team added 2.1.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Nov 3, 2017
@magento-engcom-team
Copy link
Contributor

@diazwatson, thank you for your report.
We've created internal ticket(s) MAGETWO-83251 to track progress on the issue.

@okorshenko
Copy link
Contributor

Hi @diazwatson thank you for your report. The issue has been fixed and delivered to 2.2-develop branch. Will be available with upcoming patch release

@magento-engcom-team
Copy link
Contributor

Hi @diazwatson. Thank you for your report.
The issue has been fixed in magento-engcom/magento2ce#1358 by @magento-engcom-team in 2.3-develop branch
Related commit(s):

The fix will be available with the upcoming 2.3.0 release.

@magento-engcom-team magento-engcom-team added the Fixed in 2.3.x The issue has been fixed in 2.3 release line label Feb 8, 2018
@diazwatson
Copy link
Contributor Author

Nice, thanks

@mihaikalif
Copy link

mihaikalif commented Apr 11, 2020

Was this fixed? I have magento 2.3.3 and I still replicate this when printing an attribute multiselect:
My code below
<

1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release
Projects
None yet
Development

No branches or pull requests

5 participants