Update Magento category attribute sort order from the database

If you have written your own modules, and need to rearrange the order that your attributes or displayed in, or change anything else, you can use the following SQL statements to fix their order.

First you need to get the attribute group that the attributes are under. This can be done by running the following

SELECT attribute_group_id,  attribute_group_name FROM eav_attribute_group

This will give all of the different tabs for categories as well as the products. Find the group ID that you need and then run the following command to see all of the attributes associated with it

SELECT eea.*, ea.attribute_code FROM eav_entity_attribute AS eea JOIN eav_attribute AS ea ON eea.attribute_id = ea.attribute_id WHERE eea.attribute_group_id = 4

Here we are using the group_id of 4 which gives the following result Image

The sort_order is the attribute that you need to change to move the attributes around the page. If the sort order is sequential then a simple trick to add some padding is to run the following command

UPDATE eav_entity_attribute SET sort_order = (sort_order*10) WHERE attribute_group_id = 4;

Which will multiple each sort order by 10 allowing you to move the attributes around easier.

Tags: mysqldevelopmentmagentoattributesattribute setstips