Skip to content

[Issue] Customer Attributes Options with option group fixed #30422

Closed
@m2-assistant

Description

@m2-assistant

This issue is automatically created based on existing pull request: #30421: Customer Attributes Options with option group fixed


\Magento\Customer\Ui\Component\Listing\AttributeRepository::getOptionArray method fails to return correct options for attribute with option groupsi.e store_id (created_in).

Description (*)

Magento 2.4-develop

\Magento\Customer\Ui\Component\Listing\AttributeRepository::getOptionArray method fails to return correct options for attribute with option groupsi.e store_id (created_in).
It fails for all attributes with option group in "options" index.

Related Pull Requests

Fixed Issues (if relevant)

Preconditions:

(for example)

Main Website:

  1. Main Website Store:
  • Default Store View ;
  • Second Store View;
  • Third Store View;
  1. Second Store:
  • English Store View;
  • French Store View;

Screenshot from 2020-11-18 10-24-10

Manual testing scenario:

  1. Use the \Magento\Customer\Ui\Component\Listing\AttributeRepository in any form or grid and render select options with option groups;
  2. $this->attributeRepository->getMetadataByCode($code)

Actual Result: ✖️ the method doesn't return correct options

$test = {array} [12]
 attribute_code = "store_id"
 frontend_input = "select"
 frontend_label = "Create In"
 backend_type = "static"
 options = {array} [3]
  0 = {array} [3]
   label = "Main Website"
   value = null
   __disableTmpl = true
  1 = {array} [3]
   label = "    Main Website Store"
   value = null
   __disableTmpl = true
  2 = {array} [3]
   label = "    Second Store"
   value = null
   __disableTmpl = true
 is_used_in_grid = false
 is_visible_in_grid = false
 is_filterable_in_grid = false
 is_searchable_in_grid = false
 validation_rules = {array} [0]
 required = true
 entity_type_code = "customer"

Expected Result: ✔️ the method should return correct options

$test = {array} [12]
 attribute_code = "store_id"
 frontend_input = "select"
 frontend_label = "Create In"
 backend_type = "static"
 options = {array} [3]
  0 = {array} [3]
   label = "Main Website"
   value = {array} [0]
   __disableTmpl = true
  1 = {array} [3]
   label = "    Main Website Store"
   value = {array} [3]
    0 = {array} [3]
     label = "    Default Store View"
     value = "1"
     __disableTmpl = true
    1 = {array} [3]
     label = "    Second Store View"
     value = "2"
     __disableTmpl = true
    2 = {array} [3]
     label = "    Third Store View"
     value = "3"
     __disableTmpl = true
   __disableTmpl = true
  2 = {array} [3]
   label = "    Second Store"
   value = {array} [2]
    0 = {array} [3]
     label = "    English Store View"
     value = "4"
     __disableTmpl = true
    1 = {array} [3]
     label = "    French Store View"
     value = "5"
     __disableTmpl = true
   __disableTmpl = true
 is_used_in_grid = false
 is_visible_in_grid = false
 is_filterable_in_grid = false
 is_searchable_in_grid = false
 validation_rules = {array} [0]
 required = true
 entity_type_code = "customer"

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: CustomerEvent: dmcdindia2020Fixed in 2.4.xThe issue has been fixed in 2.4-develop branchIssue: 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: PR in progressProgress: doneReported on 2.4.0Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchSeverity: S2Major restrictions or short-term circumventions are required until a fix is available.

    Type

    No type

    Projects

    Status

    Pull Request In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions