cancel
Showing results for 
Search instead for 
Did you mean: 

List of attribute keys for new Attributes, by Entity Type.

SOLVED

List of attribute keys for new Attributes, by Entity Type.

When added attributes to Entities, e.g. Customers or Products, the third argument to EavSetup::addAttribute() is an array of attribute keys. For instance:

$eavSetup->addAttribute(
  \Magento\Catalog\Model\Product::ENTITY,
  'custom_attribute',
  [
    'label' => 'Custom Attribute',
    'type' => 'int',
    'backend' => '',
    'frontend' => '',
    'input' => '',
    'class' => '',
    'source' => '',
    'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_GLOBAL,
    'visible' => true,
    'required' => false,
    'user_defined' => false,
    'default' => 0,
    'searchable' => false,
    'filterable' => false,
    'comparable' => false,
    'visible_on_front' => false,
    'used_in_product_listing' => true,
    'unique' => false,
    'apply_to' => '',
  ]
);

Where might I find a list of acceptable array keys for Products, Customers, and other Entities? Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: List of attribute keys for new Attributes, by Entity Type.

Hello @dotancohen 

 

Check out this answer :

https://magento.stackexchange.com/a/210686

Problem Solved ? Click on 'Kudos' & Accept as Solution ! Smiley Happy

View solution in original post

2 REPLIES 2

Re: List of attribute keys for new Attributes, by Entity Type.

Hello @dotancohen 

 

Check out this answer :

https://magento.stackexchange.com/a/210686

Problem Solved ? Click on 'Kudos' & Accept as Solution ! Smiley Happy

Re: List of attribute keys for new Attributes, by Entity Type.

I love it. I got to about the second step before putting down the keyboard and picking up the whiskey - then posted this question. Perhaps some day I'll be so bored as to sit down and write a Module that might go through all the relevant XML files and method definitions and database tables and tarot cards.

 

Thank you. Back to the whiskey.