How are product attributes and attribute options stored in Magento database?

As Alan Storm says: "you do not have to know about how your db works. You have to learn how the models work ". (This is not an exact quote. I gave you the meaning).

But I created own scheme to understand the DB structure. So this screen shows how it works: enter image description hereenter image description here

Hope, it helps.

Also I recommend you to look through these links:

http://www.magentocommerce.com/wiki/2_-_magento_concepts_and_architecture/magento_database_diagram

http://alanstorm.com/magento_advanced_orm_entity_attribute_value_part_1


1) The attributes are stored in eav_attribute. There you get the attribute_id.

2) The options are stored in eav_attribute_option_value. There yout get the option_id.

3) The options are assigned to the product in catalog_product_entity_varchar. There you need the entity_id of the product, the attribute_id from 1) and the value which are the comma separated option_ids from 2)

Tags:

Magento