I need to create category custom attribute in admin for root category only not to subcategories.I searched but not getting solution for that.I can only create catgory custom attributes for both Root and Subcategories.
Anyone know suggest solution. I have created category attribute using below code.
$this->addAttribute('catalog_category', 'productservice_category', array( 'group' => 'General Information', 'input' => 'select', 'option' => array ( 'values' => array( 0 => 'Product', 1 => 'Service' ) ), 'type' => 'text', 'label' => 'Product/Service Category', 'backend' => 'eav/entity_attribute_backend_array', 'visible' => true, 'required' => true, 'visible_on_front' => true, 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, ));
I need to hide or set to editable to false for that attribute while adding Subcategories.But in admin both root categories and subcategories that attributes showing.I need to hide or not to edit while adding subcategories.This is my requirement.
1 Answer 1
You can not add attribute for only specific category.
To achieve this add attribute for category and assign unique value for root category.
- 
 okay, How can I set subcategories attribute value based on that root category attribute value.Do u have any idea?Muthumahesh– Muthumahesh2016年02月01日 10:32:33 +00:00Commented Feb 1, 2016 at 10:32
- 
 For that you need to create script that will iterate all category and assign value to your attribute based on parent category of category.Minesh Patel– Minesh Patel2016年02月01日 10:36:33 +00:00Commented Feb 1, 2016 at 10:36
- 
 Did you know how to create script for that? I searched but not getting solution for that.Do you have any idea to initiate that?Muthumahesh– Muthumahesh2016年02月01日 10:59:19 +00:00Commented Feb 1, 2016 at 10:59
- 
 What is your expected final output ? because in question you need only attribute for root category. Paste your require in questionMinesh Patel– Minesh Patel2016年02月01日 11:02:14 +00:00Commented Feb 1, 2016 at 11:02
- 
 I need to hide or set to editable to false for custom attribute while adding Subcategories.But in admin both root categories and subcategories that attributes showing.I need to hide or not to edit while adding subcategories.This is my requirement.Muthumahesh– Muthumahesh2016年02月01日 11:13:20 +00:00Commented Feb 1, 2016 at 11:13
Explore related questions
See similar questions with these tags.