- 浏览: 13763997 次
- 性别:
- 来自: 洛杉矶
-
文章分类
- 全部博客 (1994)
- Php / Pear / Mysql / Node.js (378)
- Javascript /Jquery / Bootstrap / Web (435)
- Phone / IOS / Objective-C / Swift (137)
- Ubuntu / Mac / Github / Aptana / Nginx / Shell / Linux (335)
- Perl / Koha / Ruby / Markdown (8)
- Java / Jsp (12)
- Python 2 / Wxpython (25)
- Codeigniter / CakePHP (32)
- Div / Css / XML / HTML5 (179)
- WP / Joomla! / Magento / Shopify / Drupal / Moodle / Zimbra (275)
- Apache / VPN / Software (31)
- AS3.0/2.0 / Flex / Flash (45)
- Smarty (6)
- SEO (24)
- Google / Facebook / Pinterest / SNS (80)
- Tools (22)
最新评论
-
1455975567:
xuezhongyu01 写道wocan23 写道我想问下那个 ...
Mysql: LBS实现查找附近的人 (两经纬度之间的距离) -
xuezhongyu01:
wocan23 写道我想问下那个111.1是怎么得来的我也看不 ...
Mysql: LBS实现查找附近的人 (两经纬度之间的距离) -
18335864773:
试试 pageoffice 在线打开 PDF 文件吧. pag ...
jquery在线预览PDF文件,打开PDF文件 -
青春依旧:
opacity: 0.5; 个人喜欢这种方式!关于其他css特 ...
css透明度的设置 (兼容所有浏览器) -
July01:
推荐用StratoIO打印控件,浏览器和系统的兼容性都很好,而 ...
搞定网页打印自动分页问题
magento EAV数据库Magento EAV structure & role of eav_attribute’s backend_type field
Introduction:
Magento database is based on EAV(Entity Attribute Value) architecture. And it uses this architecture especially for categories, products, customers & customer addresses.
Before Magento version 1.4.x it used EAV structure for orders as well
but thereafter order’s eav structure has been converted to flat
structure.
From the defination of EAV:
Entity(E):
Entity actually refers to data item.
In Magento:
catalog_category_entity catalog_product_entity customer_entity customer_address_entity
are the entity tables for categories, products, customers & customer addresses respectively.
Attribute(A):
Attribute refers to the different attributes of an Entity.
In Magento, attributes related to an entity are stored in a single
table: eav_attribute but differentiated by field: entity_type_id.
We can easily find all the attributes related to an entity using the following SQL query(For Example: product):
SELECT attribute_code, attribute_id, backend_type FROM eav_attribute WHERE entity_type_id = (SELECT entity_type_id FROM eav_entity_type WHERE entity_type_code = 'catalog_product')
Which gives the following results:
+----------------------------+--------------+--------------+ | attribute_code | attribute_id | backend_type | +----------------------------+--------------+--------------+ | activation_information | 496 | text | | color | 272 | int | | color_code | 950 | varchar | | computer_manufacturers | 510 | int | | contrast_ratio | 875 | int | | cost | 100 | decimal | | country_orgin | 507 | text | | cpu_speed | 877 | int | | created_at | 930 | static | | custom_design | 571 | varchar | | custom_design_from | 572 | datetime | | custom_design_to | 573 | datetime | | custom_layout_update | 531 | text | | description | 97 | text | | dimension | 494 | text | | enable_googlecheckout | 903 | int | | finish | 509 | text | | gallery | 271 | varchar | | gender | 501 | int | | gift_message_available | 562 | varchar | | harddrive_speed | 878 | varchar | | hardrive | 499 | text | | has_options | 838 | static | | image | 106 | varchar | | image_label | 879 | varchar | | in_depth | 492 | text | | is_imported | 949 | int | | is_recurring | 933 | int | | links_exist | 947 | int | | links_purchased_separately | 904 | int | | links_title | 906 | varchar | | manufacturer | 102 | int | | max_resolution | 873 | varchar | | media_gallery | 703 | varchar | | megapixels | 513 | int | | memory | 498 | text | | meta_description | 105 | varchar | | meta_keyword | 104 | text | | meta_title | 103 | varchar | | minimal_price | 503 | decimal | | model | 495 | text | | name | 96 | varchar | | news_from_date | 704 | datetime | | news_to_date | 705 | datetime | | old_id | 110 | int | | options_container | 836 | varchar | | package_id | 951 | int | | page_layout | 929 | varchar | | price | 99 | decimal | | price_type | 859 | int | | price_view | 862 | int | | processor | 497 | text | | ram_size | 874 | varchar | | recurring_profile | 934 | text | | required_options | 837 | static | | response_time | 876 | varchar | | room | 508 | int | | samples_title | 905 | varchar | | screensize | 500 | text | | shape | 476 | text | | shipment_type | 863 | int | | shipping_qty | 952 | int | | shirt_size | 525 | int | | shoe_size | 502 | int | | shoe_type | 107 | int | | short_description | 506 | text | | sku | 98 | static | | sku_type | 860 | int | | small_image | 109 | varchar | | small_image_label | 880 | varchar | | special_from_date | 568 | datetime | | special_price | 567 | decimal | | special_to_date | 569 | datetime | | status | 273 | int | | tax_class_id | 274 | int | | thumbnail | 493 | varchar | | thumbnail_label | 881 | varchar | | tier_price | 270 | decimal | | updated_at | 931 | static | | url_key | 481 | varchar | | url_path | 570 | varchar | | visibility | 526 | int | | weight | 101 | decimal | | weight_type | 861 | int | +----------------------------+--------------+--------------+
Similarly you can find attributes for other entities just by using following values for entity_type_code:
catalog_category customer customer_address
or categories, customers & customer address respectively.
Note: You can get the related values for entity_type_code from table: eav_entity_type.
Value(V):
Value refers to the actual value of the attribute of the entity.
In Magento attribute values of an entity (for example: product) are stored in catalog_product_entity_[backend_type] tables.
Where [backend_type] refers to the value of field: backend_type (except value ‘static’) of table: eav_attribute.
Following SQL is used to find all the backend types related to a product entity:
SELECT DISTINCT backend_type FROM eav_attribute WHERE entity_type_id = (SELECT entity_type_id FROM eav_entity_type WHERE entity_type_code = 'catalog_product')
Which results:
+--------------+ | backend_type | +--------------+ | text | | int | | varchar | | decimal | | static | | datetime | +--------------+
So tables:
catalog_product_entity_text catalog_product_entity_int catalog_product_entity_varchar catalog_product_entity_decimal catalog_product_entity_datetime
are used for storing values for an attributes of related backend_type.
Note: You must be wondering about backend_type = static. For an attribute with the static backend_type, values are stored as a column directly in the entity table. For example: sku is an attribute of backend_type = static and it’s values are stored in the entity table itself: catalog_product_entity under field: sku.
That’s all about the definition of EAV relating to Magento.
Hopefully now you are able to differentiate which attribute values goes where (in which table) based on the backend_type.
Thanks for reading & Happy E-Commerce!!
来源:http://www.blog.magepsycho.com/magento-eav-structure-role-of-eav_attributes-backend_type-field/
发表评论
-
Magento: 后台显示图片不能找到 Image file was not found on product tab
2016-08-30 02:22 3005I was uploading some images f ... -
理解WordPress的PingBack和TrackBack
2016-08-26 02:21 5811pingback和trackback的功 ... -
零基础 Amazon Web Services (AWS) 入门教程图文版(四)
2016-06-07 11:40 1037自上一篇之后,5天过去了,这篇文章总算是挤出来了... 其实 ... -
零基础 Amazon Web Services (AWS) 入门教程图文版(三)
2016-06-07 11:41 2063原则上WDCP安装好了,就可以直接使用了,FTP、MySQL ... -
零基础 Amazon Web Services (AWS) 入门教程图文版(二)
2016-06-07 01:33 1021上一篇讲到,主机正常运转了。但是此时如果直接访问公网IP是 ... -
零基础 Amazon Web Services (AWS) 入门教程图文版(一)
2016-06-07 01:31 21807现在小站唯一的流量都靠AWS这个关键词了,刚好要用AWS重新 ... -
零基础 Amazon Web Services (AWS) 入门教程 (列表)
2016-06-07 01:32 2099在 Amazon Web Services 上托 ... -
Magento 1.9:新订单通知 Admin Order Notifier
2016-06-02 02:48 870Here is a little Mag ... -
Magento 1.9.X 系列教程
2016-05-14 02:44 2305Magento安装下载教学: Magento教程 1 ... -
Magento: 产品页面下jquery change函数失效 Call javascript function onchange product option
2016-05-05 06:39 1776明显的原因是change函数跟magento默认的oncha ... -
Magento: 判断是否为手机浏览 Optimise Web's Mobile Detect Class for Magento
2016-04-29 07:01 1179项目地址:Optimise Web's Mobile Det ... -
Magento: Gird 和 form 区域 Module Development Series – Magento Admin Module
2016-04-28 02:39 690In this tutorial, we are goi ... -
Magento: addAttributeToFilter 和 addFieldToFilter 的区别 Difference between addAttri
2016-04-28 02:34 1027addAttributeToFilter is use ... -
Magento: 后台获取menu链接 Getting the admin panel urls
2016-04-28 02:34 791The url for customer page in t ... -
Magento : 调用文件上传 upload file frontend
2016-04-27 01:25 1378bool mkdir ( string $pathname ... -
Magento: 自定义用户登录导向页面 Redirect Customer to Previous Page After Login
2016-04-26 02:45 1869Configuration Settings – L ... -
Magento: 代替flash上传 How to disable Flash uploader in Magento (product images and
2016-04-06 05:04 11401. 替换产品页flash上传按钮 - 使用 Du ... -
Magento: 在客户账户中添加自定义链接 My Account Add Link
2016-04-05 14:05 1420This extension add new link an ... -
Magento: 根据产品属性加载产品信息 Load A Category or Product by an Attribute
2016-03-26 01:35 961Load a Product by ID <?ph ... -
Magento模块开发之数据库SQL操作方法说明
2016-03-26 01:31 1395今天主要来看Magento中的Mysql4/Resource ...
评论