Fixed getAttributeRawValue when there are no value in the "default" store#2964
Merged
fballiano merged 6 commits intoOpenMage:nextfrom Apr 18, 2024
luigifab:rawattr
Merged
Fixed getAttributeRawValue when there are no value in the "default" store#2964fballiano merged 6 commits intoOpenMage:nextfrom luigifab:rawattr
fballiano merged 6 commits intoOpenMage:nextfrom
luigifab:rawattr
Conversation
Contributor
|
is this a situation that happens often? to have attributes at store-level but without the default? do we know the impact it has on the query? anywa, if M2 merged this same code, we could probably use it too. |
fballiano
previously approved these changes
Sep 18, 2023
Contributor
Author
|
Yes, we can't be lower than M2. |
Contributor
|
@luigifab do you use this in your stores? are we safe to merge it? |
Contributor
Author
|
Yes I use it. I there are issues, I don't find them. |
Contributor
|
I know it will be controversial but I think that technically we're modifying what's returned by a method that's probably used in custom code, so for that reason I think although it's a bugfix it should be treated as a breaking change. that's why I merged it in next. |
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
Reworked query in
getAttributeRawValueso that it returns a store specific value even if there is no default value.See also #23369 from Magento2.
I tested this PR with #572, and with PHP 8.0 / 8.1 / 8.2.
Manual testing scenarios
bonjourcode andstore viewscopeapp/design/frontend/rwd/default/template/catalog/product/view.phtml, add:<h1>{ <?php echo $_product->getResource()->getAttributeRawValue($_product->getId(), 'bonjour', $_product->getStoreId()) ?> }</h1>Then go to the product page, without the PR, your value is out there, with the PR, the value is displayed.
If you use now the same attribute in
checkout/cart/item/default.phtmlwith:and:
<h2>{ <?php echo $this->getItem()->getProduct()->getData('bonjour') ?> }</h2>And now it works!
SQL queries
The order of UNIQUE index is: entity_id, attribute_id, store_id
in catalog_product_entity_varchar...
the data
getAttributeRawValue
getLoadAttributesSelect (for cart and collections)
Problem: for my test (for getLoadAttributesSelect) I lost ~5 ms.
The EXPLAIN says:
Contribution checklist