Get Free Audit

How EAV Data Storage Works in Magento 2: Part 3

Jul 31, 2018

1223 Igor Rain

How EAV Data Storage Works in Magento 2: Part 3

We continue exploring the mechanism of EAV data storage in Magento 2. In this article, we will cover Magento 2 attribute types and how they are presented in the admin. In the 2nd part, we will talk about the role of attribute sets and attribute groups.

How are attributes presented in the admin

Attributes are the name (Label) + field, the value of which can be changed by the administrator.

The following attribute properties affect its display:

  • frontend_model is a class that describes the display of the field on the front end section of the site. It’s inherited from Magento\Eav\Model\Entity\Attribute\Frontend\AbstractFrontend and overrides the getValue method to change the output values of the attribute
  • frontend_input – the form element that is displayed in the admin section of the site
  • frontend_label – the name of the attribute that is displayed in the admin section of the site. It is also displayed on the frontend section of the site unless another value is specified in the eav_attribute_label table (in the attribute settings it is changed on the “Manage Labels” tab)
  • frontend_class is used to validate the attribute value in the admin section of the site. In the attribute settings, the property is called Input Validation for Store Owner. For the e-mail validation, the frontend_class property has the value “validate-email”.

Input validator for store owner

Input validation

Andrey_Dubina

Partner With Us

Let's discuss how to grow your business. Get a Free Quote.
Talk to Andrey

Magento has the following standard attribute types:

Text Field

It is represented as a text input

Text field

Text Area

It is represented as a multi-line field. It is possible to turn on the WYSIWYG editor in its attribute settings.

Text area

Date

It appears as a text field for entering dates and a drop-down calendar.

Date field

Yes/No

It is represented in the form of a switch that has 2 positions: Yes and No

Yes\No field

Multiple Select

It is presented in the form of a list that suggests choosing several values, including none.

Multiple select

Dropdown

It is represented in the form of a drop-down list that suggests choosing only one value.

Dropdown menu

Price

It appears in the form of a drop-down list.

Andrey_Dubina
Partner With Us Let's discuss how to grow your business. Get a Free Quote.
Talk to Andrey

Price field

Media Image

Media Image is represented differently than other fields. There is no field for Media Image. An attribute of the Media Image type adds a role to an image and a video of the product.

 

 

 

Media image

Media image

 

 

 

 

 

 

 

Magento Audit

Magento Audit

Take your online store to the next level with BelVG Magento Audit

Visit the page

Fixed Product Tax

Allows changing taxes for countries and their states. It is presented in the form of a table with a country and a state and the corresponding tax.

 

Fixed product tax

Visual Swatch

Visual Swatch is presented to the administrator the same way as the Dropdown. To a user, it is presented in the form of buttons, filled with color, or containing a picture. The field is convenient to use in Configurable products, for example, for color selection.

Visual swatch

Text Swatch

It is similar to Visual Swatch, only the contents of the button is text.

Text swatch

The role of attribute sets and attribute groups

An attribute set is needed in order to display different attributes when editing different types of products (like shoes and clothing). For example, we have the shoe_size and clothing_size attributes. For footwear, you need to display the shoe_size attribute, for clothes — clothing_size. Attribute set allows hiding unnecessary attributes, displaying the necessary ones, changing the sorting and grouping. Groups are needed for the convenience of filling the products by an administrator. They have no effect on the logic of loading / storing the products.

 

Below you can see the Design and Schedule Design Update folders, which are attribute groups. The nested elements are attributes.

Design and Schedule Design Update

Attributes in the product:

Attributes in the product

That’s it for part 3. The series is to be continued with part 4, in which we will cover additional options when saving EAV entities and customizations based on changes to attribute values.

magento webdesign

Magento Webdesign

Take your online store to the next level with BelVG Magento Webdesign

Visit the page
Andrey Dubina
Partner With Us Looking for a partner to grow your business? We are the right company to bring your webstore to success. Talk to Andrey

2 Comments

Post a new comment

BelVG Newsletter
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
Email *