[Magento] Add custom attribute by SQL

Step 1) Insert AttributeData

INSERT INTO `eav_attribute` (`entity_type_id`,`attribute_code`, `attribute_model`, `backend_model`,`backend_type`, `backend_table`, `frontend_model`,`frontend_input`, `frontend_label`, `frontend_class`,`source_model`, `is_required`, `is_user_defined`, `default_value`,`is_unique`, `note`) VALUES (3, 'main_heading', NULL, '','varchar', '', '', 'text', 'SEO Main Heading', '', '', 0, 0, '1',0, '');
The fields we will need to changeare:
attribute_code =main_heading
frontend_label = SEO MainHeading
Once extrinsic this table’s primary pivotalattribute_id will allot a series to a row. In my box a series was147, so I’ll use 147 from now on. Obviously use whichever series isgiven to your attribute.

Step 2) Insert AttributeType

INSERT INTO `eav_entity_attribute`(`entity_type_id`, `attribute_set_id`, `attribute_group_id`,`attribute_id`, `sort_order`) 
VALUES (3, 3, 3, 147, 7);
The fields we will need to changeare:
attribute_id = 147

Step 3) Create Attribute

INSERT INTO `catalog_eav_attribute`(`attribute_id`, `frontend_input_renderer`, `is_global`,`is_visible`,`is_searchable`, 
`is_filterable`, `is_comparable`,`is_visible_on_front`, `is_html_allowed_on_front`,`is_used_for_price_rules`, 
`is_filterable_in_search`,`used_in_product_listing`, `used_for_sort_by`, `is_configurable`,`apply_to`, 
`is_visible_in_advanced_search`, `position`,`is_wysiwyg_enabled`,`is_used_for_promo_rules`) 
VALUES (147, '', 0, 1, 0, 0, 0, 1, 0, 0, 0, 0,0, 1, '', 0, 0, 0, 0);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值