Question

Can any body tell me where is category attribute stored in magento database ? And how could I remove it from MySQL?

Was it helpful?

Solution

All category attributes (and products and customer and customer address) are kept in the table eav_attribute.
You can identify it by this query:

SELECT * FROM `eav_attribute` WHERE `attribute_code` = 'Your code here';

If you get only one record as a result then you are save. That's it.
If you get 2 or more it means that the attribute with that code exists for more entities (for example url_key will show 2 results).

In this case the difference is made by entity_type_id field.
That's the one that determines the entity (category, product, ...)

To get the entity_type_id for the category, run this query:

SELECT * FROM `eav_entity_type` where `entity_type_code` = 'catalog_category';

To merge the 2 queries above and always get the result you need you can use this:

SELECT 
    * 
FROM 
    `eav_entity`
WHERE
    `attribute_code` = 'YOUR CODE HERE' AND
    `entity_type_id` = (SELECT
                           `entity_type_id`
                        FROM
                           `eav_entity_type`
                        WHERE
                           `entity_type_code` = 'catalog_category'
                       )

OTHER TIPS

Simply Run this Query:- For Disable the category from Database

First Method

For setting is_active = Yes

UPDATE `catalog_category_entity_int` SET `value` = '1' WHERE `catalog_category_entity_int`.`entity_id` =5 AND `catalog_category_entity_int`.`attribute_id` = 62;

For setting is_active = No

UPDATE `catalog_category_entity_int` SET `value` = '0' WHERE `catalog_category_entity_int`.`entity_id` =5 AND `catalog_category_entity_int`.`attribute_id` = 62;

NOTE:- Here 62 is an 'attribute_id' of is_active attribute (that you can find in 'eav_attribute table'), so we are using catalog_category_entity_int.attribute_id = 62 in this sql query.

Second Method

First of all Find attribute_id in eav_attribute table thats associated with is_active and then look for the attribute_id value in catalog_category_entity_int there you'll find a value (Column in Table) boolean, set value = 1 for Active and set value =0 for Deactive.

enter image description here

        DELETE FROM eav_attribute where attribute_code='ryman_tuner_radio'
        DELETE FROM eav_attribute_group where attribute_group_name='Company';   
        # DELETE FROM `core_resource` where `code` = 'customcatattrcompany_setup'; 

The following will remove the Attribute from php.

        $setup->removeAttribute('catalog_category','custom_company_department');
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top