2

I have add some custom category attribute. When i go for admin, i cant find any custom attribute in manage category. I went throw the code and found in

magento/app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tabs.php 

that, when I print the $categoryAttributes I got the value, first value is "Custom attribute" and the value i got

[963] => Mage_Catalog_Model_Resource_Eav_Attribute Object
                                (
                                    [_eventPrefix:protected] => catalog_entity_attribute
                                    [_eventObject:protected] => attribute
                                    [_cacheTag:protected] => EAV_ATTRIBUTE
                                    [_name:protected] => 
                                    [_entity:protected] => Mage_Catalog_Model_Resource_Category Object
 *RECURSION*
                                    [_backend:protected] => 
                                    [_frontend:protected] => 
                                    [_source:protected] => 
                                    [_attributeIdCache:protected] => Array
                                        (
                                        )

                                    [_dataTable:protected] => catalog_category_entity_text
                                    [_resourceName:protected] => catalog/attribute
                                    [_resource:protected] => 
                                    [_resourceCollectionName:protected] => catalog/attribute_collection
                                    [_dataSaveAllowed:protected] => 1
                                    [_isObjectNew:protected] => 
                                    [_data:protected] => Array
                                        (
                                            [attribute_id] => 963
                                            [entity_type_id] => 9
                                            [attribute_code] => custom_attribute
                                            [attribute_model] => catalog/resource_eav_attribute
                                            [backend_model] => 
                                            [backend_type] => text
                                            [backend_table] => 
                                            [frontend_model] => 
                                            [frontend_input] => textarea
                                            [frontend_label] => Custom attribute
                                            [frontend_class] => 
                                            [source_model] => 
                                            [is_required] => 0
                                            [is_user_defined] => 0
                                            [default_value] => 
                                            [is_unique] => 0
                                            [note] => 
                                            [frontend_input_renderer] => 
                                            [is_global] => 1
                                            [is_visible] => 1
                                            [is_searchable] => 0
                                            [is_filterable] => 0
                                            [is_comparable] => 0
                                            [is_visible_on_front] => 1
                                            [is_html_allowed_on_front] => 0
                                            [is_used_for_price_rules] => 0
                                            [is_filterable_in_search] => 0
                                            [used_in_product_listing] => 0
                                            [used_for_sort_by] => 0
                                            [is_configurable] => 1
                                            [apply_to] => 
                                            [is_visible_in_advanced_search] => 0
                                            [position] => 0
                                            [is_wysiwyg_enabled] => 0
                                            [is_used_for_promo_rules] => 0
                                            [attribute_set_info] => Array
                                                (
                                                    [12] => Array
                                                        (
                                                            [group_id] => 7
                                                            [group_sort] => 10
                                                            [sort] => 25
                                                        )

                                                )

                                        )

                                    [_hasDataChanges:protected] => 1
                                    [_origData:protected] => 
                                    [_idFieldName:protected] => attribute_id
                                    [_isDeleted:protected] => 
                                    [_oldFieldsMap:protected] => Array
                                        (
                                        )

                                    [_syncFieldsMap:protected] => Array
                                        (
                                        )

                                )

Second attribute is "Best" and the value i got

[962] => Mage_Catalog_Model_Resource_Eav_Attribute Object
                                (
                                    [_eventPrefix:protected] => catalog_entity_attribute
                                    [_eventObject:protected] => attribute
                                    [_cacheTag:protected] => EAV_ATTRIBUTE
                                    [_name:protected] => 
                                    [_entity:protected] => Mage_Catalog_Model_Resource_Category Object
 *RECURSION*
                                    [_backend:protected] => 
                                    [_frontend:protected] => 
                                    [_source:protected] => 
                                    [_attributeIdCache:protected] => Array
                                        (
                                        )

                                    [_dataTable:protected] => catalog_category_entity_varchar
                                    [_resourceName:protected] => catalog/attribute
                                    [_resource:protected] => 
                                    [_resourceCollectionName:protected] => catalog/attribute_collection
                                    [_dataSaveAllowed:protected] => 1
                                    [_isObjectNew:protected] => 
                                    [_data:protected] => Array
                                        (
                                            [attribute_id] => 962
                                            [entity_type_id] => 9
                                            [attribute_code] => best
                                            [attribute_model] => catalog/resource_eav_attribute
                                            [backend_model] => 
                                            [backend_type] => varchar
                                            [backend_table] => 
                                            [frontend_model] => 
                                            [frontend_input] => text
                                            [frontend_label] => BEST
                                            [frontend_class] => 
                                            [source_model] => 
                                            [is_required] => 0
                                            [is_user_defined] => 0
                                            [default_value] => 
                                            [is_unique] => 0
                                            [note] => 
                                            [frontend_input_renderer] => 
                                            [is_global] => 1
                                            [is_visible] => 1
                                            [is_searchable] => 0
                                            [is_filterable] => 0
                                            [is_comparable] => 0
                                            [is_visible_on_front] => 1
                                            [is_html_allowed_on_front] => 0
                                            [is_used_for_price_rules] => 0
                                            [is_filterable_in_search] => 0
                                            [used_in_product_listing] => 0
                                            [used_for_sort_by] => 0
                                            [is_configurable] => 1
                                            [apply_to] => 
                                            [is_visible_in_advanced_search] => 0
                                            [position] => 0
                                            [is_wysiwyg_enabled] => 0
                                            [is_used_for_promo_rules] => 0
                                            [attribute_set_info] => Array
                                                (
                                                )

                                        )

                                    [_hasDataChanges:protected] => 1
                                    [_origData:protected] => 
                                    [_idFieldName:protected] => attribute_id
                                    [_isDeleted:protected] => 
                                    [_oldFieldsMap:protected] => Array
                                        (
                                        )

                                    [_syncFieldsMap:protected] => Array
                                        (
                                        )

                                )

Now my problem is whether i got the value in this file. One custom attribute is displayed in the admin "Custom Attribute", but the other "Best" attribute is not displayed in the admin.

6
  • Can you post the code you used to add it?
    – Marius
    Commented Oct 3, 2013 at 8:09
  • I use the magentocommerce.com/magento-connect/custom-attributes-4340.html extension for save custom category attribute. Commented Oct 3, 2013 at 9:04
  • Maybe you should contact the extension developer.
    – Marius
    Commented Oct 3, 2013 at 9:08
  • When you were searching for your custom attribute did you search for 'Best' or 'BEST' as the frontend label is all in caps.
    – rob3000
    Commented Oct 3, 2013 at 9:12
  • Yes i did everything. Now i got some extra clue. Like in the "customerController" and "AddressController", i got this code if($this->_block == 'customer' || $this->_block == 'address') { $attribute = Mage::getModel('eav/entity_attribute')->load($id); Mage::getSingleton('eav/config') ->getAttribute($this->_type, $attribute->getAttributeCode()) ->setData('used_in_forms', $data['customer_form']) ->save(); }" If you see there is no codition for category. So can you help me to know the condition for category. Commented Oct 3, 2013 at 9:53

1 Answer 1

1

It appears that the second attribute is not assigned to a set. When building all the tabs in the admin section for categories the system will load each set as a tab. So if your attribute is not assigned to a set it will not show via the admin section on a category as there is no tab to attach the attribute to.

If you add these attributes to a set, either a new one or an existing one, then they will show up. This can be done via the admin section under Catalog->Attributes->Manage Attribute Sets then select the set you want the attributes to be under using the drag and drop. Or you can add attributes to sets via set-up scripts with the function addAttributeToSet($entityTypeId, $setId, $groupId, $attributeId, $sortOrder=null)

First Attribute

[attribute_set_info] => Array
(
    [12] => Array
    (
        [group_id] => 7
        [group_sort] => 10
        [sort] => 25
    )
)

Second attribute

[attribute_set_info] => Array
(
)

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.