I’ve installed magento edition version 1.9.2.0 and added a custom attribute catalog_special_name
(text field) and i want to know which table stores the custom attribute values for each product.
Magento – Find the table for custom attribute values
custom-attributeseavmagento-1.9product-attribute
Best Answer
When you create a attribute for a product EAV comes in a picture. To get a value you need to know basics, which magento uses to store eav data.
For this following tables plays a important role.
eav_attribute
Whenever you create a attribute this table gets entry which stores all important data which helps to make a relation, like
entity_type_id,attribute_code,backend_type
and many more but this are the important fields.eav_entity_type
Magento has 8 types of entity, by which, type of attribute is decided. in your case it is catalog_product
customer
customer_address
catalog_category
catalog_product
order
invoice
creditmemo
shipment
How we say it is
catalog_product
in your case ?So the answer is as i said above when you create a new attribute their will be a entry in eav_attribute and if you check this entry their will be a column as
entity_type_id
whose value is 4 which is nothing but a catalog_product of eav_entity_type table.eav_attribute table also has a column known as
attribute_code
which is nothing but a value of Attribute Code entered while making a new attribute from admin.So as in your case we find it as a catalog_product we will look for all tables whose initial are from catalog_product you will get a table whose ending is like
datetime,decimal,text,varchar,text,int
etc.catalog_product_entity is the primary table for product, our product id is nothing but a value of
entity_id
of this table.How we get a desired table ?
in eav_attribute table their is a column
backend_type
by which we decide on which table we get a values. In your case it might be varchar. So we are going to look for a catalog_product_entity_varchar table. in this table we will search for aattribute_id and entity_id
which is a product id and which we can see in admin grid and which is equal toentity_id
of catalog_product_entity table.Its time for a practical !!!
catalog_special_name
So in eav_attribute table we will search for a record whose
attribute_code = catalog_special_name
and we will get a useful information which isattribute_id,entity_type_id and backend_type
.lets say
attribute_id = 138,entity_type_id = 4 and backend_type = varchar
.so as we got
entity_type_id = 4
we will look in eav_entity_type table and confirm that our attribute is for catalog_product.Then its time for catalog_product_entity_varchar table here we will search a record for whose
attribute_id = 138 and entity_id = 13
which is our product id and that's it here you get a value.Hope this helps you.
Their are still some more important table in it. For more details on EAV you can follow
and many more..