Skip to content

Attribute getStoreLabel wrong behavior #37953

Open
@Nuranto

Description

Preconditions and environment

  • Magento version 2.4.6-p2

Steps to reproduce

  1. Create any attribute, with a default label
  2. Set a different label for store id = X
  3. load attribute on admin area, and dump $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 :

public function getStoreLabel($storeId = null)
{
if ($this->hasData('store_label')) {
return $this->getData('store_label');
}
$store = $this->_storeManager->getStore($storeId);

A fix could be :

if (null === $storeId && $this->hasData('store_label')) { instead of if ($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

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Area: ProductComponent: EavIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: ready for devReported on 2.4.6-p2Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions