Skip to content
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

Customer EAV attribute generation #583

Conversation

ProkopovVitaliy
Copy link
Contributor

Description (*)

Added customer eav attribute generation
Screenshot 2021-04-29 at 12 20 01

For example lent's add multiselect attribute with options:

  1. Open and fill attribute dialog:
    Screenshot 2021-04-29 at 12 21 07

  2. Check generated Data Patch file:
    Screenshot 2021-04-29 at 12 21 30

  3. After setup:upgrade execution check customer in admin panel:
    Screenshot 2021-04-29 at 12 27 07

Let's create required attribute that will show in customers grid:

  1. Open and fill dialog form:
    Screenshot 2021-04-29 at 12 30 56

  2. Check generated Data Patch file:
    Screenshot 2021-04-29 at 12 31 22

  3. After setup:upgrade execution check customer in admin panel:
    Screenshot 2021-04-29 at 12 33 15
    Screenshot 2021-04-29 at 12 33 40

Fixed Issues (if relevant)

  1. Fixes magento/magento2-phpstorm-plugin#<issue_number>

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 integration/functional tests (if applicable)
  • All automated tests passed successfully (all builds are green)

@drpayyne
Copy link
Contributor

Hi @ProkopovVitaliy, thanks for your very useful contribution. But can we please not use deprecated methods? Like the model save() which you're using in the data patch?

@VitaliyBoyko, I'm assuming we don't want to use deprecated methods or bad practices in this project. Since every Magento developer in the world will be using this and we're only spreading bad code by doing so since we are the platform. :)

'used_in_forms',
[${CUSTOMER_FORMS}]
);
$attribute->save();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use a resource model instead

@eduard13 eduard13 changed the title Customer aev attribute generation Customer EAV attribute generation May 5, 2021
Copy link
Contributor

@eduard13 eduard13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ProkopovVitaliy thank you for the feature, could you please check the below comments? Additionally, I'd have the following points, that can be done separately:

  • Can we have the dialog height more compact? Now, the fields' spaces are dependent by the number of shown fields.
  • Add some dependencies between Input and Type? Which means, that if you selected text for Input, the only available options for Type (which should be Backend Type) would be text, 'varchar'. Magento default the following info \Magento\CustomAttributeManagement\Helper\Data::getAttributeInputTypes while creating the attributes from the backend.
    Thank you.


public enum CustomerForm {

ADMINHTML_CHECKOUT("adminhtml_checkout"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this form isn't getting used at all? Based on the UI, we have only the following available forms
image

Comment on lines +26 to +28
USER_DEFINED("user_defined"),
POSITION("position"),
SYSTEM("system");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that it makes sense to give the possibility to configure both user_defined and system. Since user_defined = true, automatically means system = false, and vice versa.

/*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
*

/*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove all such occurrences.

Suggested change
*

@bohdan-harniuk
Copy link
Collaborator

Hello, @ProkopovVitaliy!

Could you please tell me when you can finish development here?

Regards,

@bohdan-harniuk bohdan-harniuk linked an issue Feb 3, 2022 that may be closed by this pull request
@VitaliyBoyko
Copy link
Contributor

@bohdan-harniuk I'll cover @ProkopovVitaliy back here.

Vitaliy Boyko added 2 commits February 15, 2022 13:38
…to/magento2-phpstorm-plugin into customer-aev-attribute-generation
@VitaliyBoyko
Copy link
Contributor

Add some dependencies between Input and Type? Which means, that if you selected text for Input, the only available options for Type (which should be Backend Type) would be text, 'varchar'. Magento default the following info \Magento\CustomAttributeManagement\Helper\Data::getAttributeInputTypes while creating the attributes from the backend.
Thank you.

I suggest making such improvements in a separate PR. All other things were fixed.

@VitaliyBoyko VitaliyBoyko merged commit 5af5127 into magento:mainline-eav-attr-code-genearators Feb 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Customer attribute setup patch generator
6 participants