Magento - How to add new image upload field in Manage Categories

Posted by Damodar Bashyal on February 23, 2012

 

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.

//eav_attribute: adding image upload field (new category attribute field)
//==============

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);
  
//NOTE:: inserted id: 969 (may be different for you)

Then run below SQL codes: attribute_set_id '167' is Custom Design Tab in my case (magento version 1.6.1.0).

//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

Finally:

//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);

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?

Alex posted on - Thursday 23rd of August 2012 09:50:04 PM

Hey your code helped me, now i have a question how can i make a multiple images upload for the category, and add a text field for each image, I was trying to maek something similar as the product page but I'm a newbie and couldn't found how to. I appreciate your help
 
not published on website


QR Code: Magento - How to add new image upload field in Manage Categories