Entities Catalog_Product in Magento 2

Entities Catalog_Product in Magento 2

The article is dedicated to catalog product, the tables used for creating attributes, attribute set, attribute group. The first part of the article has already been published. Don’t forget to review EAV in Magento 2 in order to have a full understanding of the issue.

 1.10. Create product attribute with Visual Swatch type

1.11. Create product attribute with Text Swatch type

2. Create attribute set with our new attributes. You can perform this in the admin panel: Stores – Attributes – Attribute Sets – Add Attribute Sets

3. Add new attribute group in attribute set

Add new attribute group in attribute set as it is shown in the picture below. Save it and check the queries. Firstly, the record about a new attribute group is added:

For each attribute, the same queries are made. The difference is in attribute_id and sort_order. Check all SQL queries.

Let’s have a closer look at SQL queries using the following attribute:

Redundant line, as all the attributes created have entity_type_id = 4

Update attribute label. If we assigned the label for the attribute, there would be a new line added:

Two couples of similar queries where we get data updated: eav_entity_attribute

In such a manner, if we remove query redundancy and imagine creating attributes with no labels for the first time, the only query will be enough:

One might create 1 query for all 11 attributes:

The picture below contains the tables we’ve already dealt with:

Entities Catalog_Product in Magento 2_14. Let’s consider the tables used when assigning attributes to products.

When saving attribute values, it’s necessary to use the tables eav_entity_{type}

entity_id – id product.

4.1. Text Field

4.2. Text Area

4.3. Date

4.4. Yes/No

In the example yes/no attribute is equal to yes(1).

4.5. Multiple Select

For multi-selection I chose 2 values. It’s apparent that id values are saved as lines.

4.6. Dropdown

4.7. Price

4.8. Media Image

4.9. Fixed Product Tax

4.10. Visual Swatch

4.11. Text Swatch



2 comments

Post a new comment

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