-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Magento Extensions Development
By :
The EAV structure in Magento is used for complex models, such as customer and product entities. In our extension, if we want to add a new field for our events, we would have to add a new column in the main table. With the EAV structure, each attribute is stored in a separate table depending on its type. For example, catalog_product_entity, catalog_product_entity_varchar and catalog_product_entity_int.
Each row in the subtables has a foreign key reference to the main table. In order to handle multiple store views in this structure, we will add a column for the store ID in the subtables.
Let's see an example for a product entity, where our main table contains only the main attribute:

The varchar table structure is as follows:

The 70 attribute corresponds to the product name and is linked to our 1 entity.
There is a different product name for the store view, 0 (default) and 2 (in French in this example).
In order to create an EAV model, you will have to extend the right class in...