0

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

0

You can not add attribute for only specific category.

To achieve this add attribute for category and assign unique value for root category.

6
  • okay, How can I set subcategories attribute value based on that root category attribute value.Do u have any idea? Commented 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. Commented 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? Commented 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 question Commented 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. Commented Feb 1, 2016 at 11:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.