Magento Diagram – Create Product Attribute
23 July 2010
1,059 views
No Comment
Magento Diagram – Create Product Attribute (Magento 1.4.1.0)
Example with the “Size” Product Attribute
Using the admin panel, we create a new product attribute Size with the following properties and options :
PROPERTIES
- Attribute Code: size
- Scope : Global
- Catalog Input Type for Store Owner : Dropdown
- Use To Create Configurable Product : Yes
OPTIONS
- Small
- Medium
- Large
The SQL queries
Here are the queries performed against the MySQL server while creating the Size product attribute:
# # # SET NAMES utf8 # # Append new attribute (Size) to the given entity type (Product) # # Table: eav_attribute # INSERT INTO `eav_attribute` (`entity_type_id`, `attribute_code`, `backend_type`, `frontend_input`, `frontend_label`, `source_model`, `is_required`, `is_user_defined`, `is_unique`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) # # Table: eav_attribute_label (used for translation ?) # DELETE FROM `eav_attribute_label` WHERE (attribute_id = '118') # # Table: catalog_eav_attribute # INSERT INTO `catalog_eav_attribute` (`attribute_id`, `is_global`, `is_searchable`, `is_filterable`, `is_comparable`, `is_visible_on_front`, `is_html_allowed_on_front`, `is_filterable_in_search`, `used_in_product_listing`, `used_for_sort_by`, `is_configurable`, `apply_to`, `is_visible_in_advanced_search`, `is_used_for_promo_rules`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) # # Add attribute options # # Table: eav_attribute_option # Table: eav_attribute_option_value # INSERT INTO `eav_attribute_option` (`attribute_id`, `sort_order`) VALUES (?, ?) DELETE FROM `eav_attribute_option_value` WHERE (option_id='7') INSERT INTO `eav_attribute_option_value` (`option_id`, `store_id`, `value`) VALUES (?, ?, ?) INSERT INTO `eav_attribute_option` (`attribute_id`, `sort_order`) VALUES (?, ?) DELETE FROM `eav_attribute_option_value` WHERE (option_id='8') INSERT INTO `eav_attribute_option_value` (`option_id`, `store_id`, `value`) VALUES (?, ?, ?) INSERT INTO `eav_attribute_option` (`attribute_id`, `sort_order`) VALUES (?, ?) DELETE FROM `eav_attribute_option_value` WHERE (option_id='9') INSERT INTO `eav_attribute_option_value` (`option_id`, `store_id`, `value`) VALUES (?, ?, ?) # # Update attribute label (Size) # # Table: eav_attribute # UPDATE `eav_attribute` SET `default_value` = ? WHERE (attribute_id='118') # # Table: index_process # Table: index_event # Table: index_process_event # UPDATE `index_process` SET `status` = ? WHERE (process_id='7') INSERT INTO `index_event` (`type`, `entity`, `entity_pk`, `created_at`, `old_data`, `new_data`) VALUES (?, ?, ?, ?, ?, ?) INSERT INTO `index_process_event` (`process_id`, `event_id`, `status`) VALUES (?,?,?) ON DUPLICATE KEY UPDATE `status`=VALUES(`status`) INSERT INTO `index_process_event` (`process_id`, `event_id`, `status`) VALUES (?,?,?) ON DUPLICATE KEY UPDATE `status`=VALUES(`status`)










