Open Nuranto opened 1 year ago
Hi @Nuranto. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:
@magento give me 2.4-develop instance
- upcoming 2.4.x release@magento I am working on this
Join Magento Community Engineering Slack and ask your questions in #github channel. :warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting. :clock10: You can find the schedule on the Magento Community Calendar page. :telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.
Hi @engcom-November. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
Area: XXXXX
label to the ticket, indicating the functional areas it may be related to.2.4-develop
branch@magento give me 2.4-develop instance
to deploy test instance on Magento infrastructure. 2.4-develop
branch, please, add the label Reproduced on 2.4.x
.Issue: Confirmed
once verification is complete. Hello @Nuranto,
Thank you for the report and collaboration!
We have tried to reproduce the issue on 2.4-develop. But we got the expected result.
We have created a custom module to dump the storeLabel
in the admin panel.
Please take a loot at the screenshot below:
It can be observed that we are getting the store label of the specific website. Please find the custom module and let us know if we are missing anything. LabelVendor.zip
Thank you.
What if you add another store, and you try to display the label of both stores ? Something like this in your block :
public function getLabel() {
$this->attribute = $this->repository->get('test_attribute');
var_dump($this->attribute->getStoreLabel(2));
var_dump($this->attribute->getStoreLabel(3));
}
Hello @Nuranto,
Thank you for the quick response.
We have taken your input and tried to reproduce the issue, still we are getting the expected result. Please take a look at the below screenshot:
We are able to get the store label of the second store as well. Please verify if the issue is reproducible on your end, and let us know if we are missing aything.
Thank you.
Ok, I think I have the missing step.
In your block, load a product (of an attribute set that contains your test attribute) from product repository just before loading the attribute.
Hello @Nuranto,
Thank you for the quick response!
As your input we loaded the attribute form the product itself, and not from the attribute repository. And the issue is reproducible. Please take a look at the screenshot below:
It can be seen that even though we are dumping store labels of 2 different storeID, we are still getting the default label.
Please find below the custom module used to reproduce the issue. LabelVendor.zip
Thank you.
:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-9631 is successfully created for this GitHub issue.
:white_check_mark: Confirmed by @engcom-November. Thank you for verifying the issue.
Issue Available: @engcom-November, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.
:x: You don't have permission to export this issue.
@magento I am working on this
Hello @Nuranto,
Re-verified this issue on 2.4-develop, issue is still present. We are still getting the default labels for all the store.
Thank you.
:x: Cannot export the issue. This GitHub issue is already linked to Jira issue(s): https://jira.corp.adobe.com/browse/AC-9631
Preconditions and environment
Steps to reproduce
$attribute->getStoreLabel(X)
Expected result
Store label is dumped
Actual result
Default label is dumped
Additional information
The problem is quite obvious when watching the first method lines :
https://github.com/magento/magento2/blob/3cc15fbed80c1f75c77c7cfeeaaba3ca25fe81b8/app/code/Magento/Eav/Model/Entity/Attribute.php#L490-L495
A fix could be :
if (null === $storeId && $this->hasData('store_label')) {
instead ofif ($this->hasData('store_label')) {
But it's probably a bit more complicated than that, we probably want to use default value if store label is empty or not set
Workaround :
$attribute->unsetData('store_label')->getStoreLabel($storeId);
Release note
No response
Triage and priority