-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Performance - Optimize getSpecificOptions triggered by all getAttributeText calls #39476
base: 2.4-develop
Are you sure you want to change the base?
Conversation
Hi @anthony-blackbird. Thank you for your contribution!
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
… array. This way PHPUnit don't see the difference.
…of github.com:anthony-blackbird/magento2 into 36174-get-attribute-text-specific-options-performance
While the PR is processed, I suggest this package I developed, compatible with Magento 2.4.x. It also introduces a cache layer for these specific options loaded. I might add it to my PR if Magento Team is interested too. More details on the readme : https://github.com/blackbird-agency/magento-eav-optimize |
@magento run all tests |
Description (*)
When performing a call to
$product->getAttributeText('my_attribute')
to output the text value of the attribute, it always trigger a call to database. I introduce a memoization to save the previously calculated result and avoid to call database each time for the same combination $storeId / $attributeId / $optionIdRelated Pull Requests
Fixed Issues (if relevant)
Manual testing scenarios (*)
getAttributeText('color')
loadSpecificOptions
Questions or comments
Contribution checklist (*)