I needed an extra image field for a category so that i can use image
uploaded there as background image on that category page. So, that
clients can have special backgrounds on festive seasons and other
special events.
Here I am just going to show how to add new field quickly and easily without breaking anything.
First login to PHPmyadmin and select the database. Then run below sql code and take a note of inserted ID, 969 was in my case.
Then run below SQL codes: attribute_set_id '167' is Custom Design Tab in my case (magento version 1.6.1.0).
Finally:
Now goto your 'manage categories' section in admin and click 'Custom Design' Tab. There you will find new image upload field. How cool is that?
Here I am just going to show how to add new field quickly and easily without breaking anything.
First login to PHPmyadmin and select the database. Then run below sql code and take a note of inserted ID, 969 was in my case.
1 | //eav_attribute: adding image upload field (new category attribute field) |
2 | //============== |
3 |
4 | INSERT
INTO `eav_attribute` (`attribute_id`, `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 |
| ('', 9, 'body_image', NULL, 'catalog/category_attribute_backend_image', 'varchar', NULL, NULL, 'image', 'Body BG Image', NULL, NULL, 0, 0, NULL, 0, NULL); |
| |
7 | //NOTE:: inserted id: 969 (may be different for you) |
1 | //NOTE: attribute_id is ID of previous inserted ID. So replace 969 with your ID. |
|
| INSERT
INTO `eav_entity_attribute` (`entity_attribute_id`, `entity_type_id`,
`attribute_set_id`, `attribute_group_id`, `attribute_id`, `sort_order`)
VALUES ('', 9, 12, 167, 969, 700); |
| //sort_order '700' because i want it to be last |
1 | //Do same here, replace '969' with your ID. |
|
| 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 (969, '', 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', 0, 0, 0, 0); |
Comments
Post a Comment
Feel Free To Ask...