What does backend type static mean in Magento?

If you check in eav_attribute table in Magento database, you will see that some of the attributes have static as backend_type. I recently wanted to add additional date attribute for customer. I used the same configuration as dob as dob also a date attribute. Everything works fine and it rendered the attribute in back-end. But I had hard time saving the value.

I finally wanted to explore what is this static backend type is really. And I queried the database to find what are the available attributes with same type and I ended up getting 55 of them which are we always dealing with in coding level (firstname, lastname etc for customer_entity)

It came to my notice that those attributes are same as fields which are in entity main tables. For example created_at, has_options, required_options, sku, updated_at attributes in catalog_product_entity table are all having static as backend_type.

And values of those attributes are directly saved on entity main tables (catalog_product_entity, customer_entity etc) but not on entity_[type] tables (like catalog_product_entity_varchar, catalog_product_entity_datetime etc ).

Therefor, if a static attribute is adding, a new column has to be added to the main entity table of the model with same name as attribute_code. Else, there will be no place to save the value (since entity_[type] tables doesn’t save those data).

For example, there is a column for sku in catalog_product_entity table and the sku value will be directly stored in catalog_product_entity table but not in catalog_product_entity_varchar table. These values can retrieve without adding to the select but non-static values can not.

Leave a Reply

Your email address will not be published. Required fields are marked *