-
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
Fixes nested array for used products cache key #21754
Fixes nested array for used products cache key #21754
Conversation
When $requiredAttributeIds is passed as an array, it was previously being added to the $keyParts array directly, which resulted in a nested array. When this nested array is passed to getUsedProductsCacheKey(), the implode() in that function throws a notice and produces a cache key that contains the non-unique string "Array" as a part. This can result in caching errors where simple children of configurable products are concerned (e.g., swatches).
Hi @michaellehmkuhl. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
Hi @VladimirZaets, thank you for the review. |
@michaellehmkuhl thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository. |
✔️ QA Passed |
Hi @michaellehmkuhl, thank you for your contribution! |
Description (*)
When $requiredAttributeIds is passed as an array, it was previously being added to the $keyParts array directly, which resulted in a nested array. When this nested array is passed to getUsedProductsCacheKey(), the implode() in that function throws a notice and produces a cache key that contains the non-unique string "Array" as a part. This can result in caching errors where simple children of configurable products are concerned (e.g., swatches).
Fixed Issues (if relevant)
N/A - no existing issue found
Manual testing scenarios (*)
Call Magento\ConfigurableProduct\Model\Product\Type\Configurable::getUsedProducts($product, $requiredAttributeIds = null) passing different $requiredAttributeIds arrays of attribute codes and confirm that Magento\ConfigurableProduct\Model\Product\Type\Configurable::getUsedProducts() returns unique cache keys for each.
Contribution checklist (*)