Magento – How to Change Default Attribute ‘Position’ in Layered Navigation

attributesce-1.9.2.0default valuesposition;

I'm organizing my attributes to show in a specific order in layered navigation. To do this I need to set the 'position' value of them all. Magento defaults them to 0 so to put an attribute (say color) at the top of the list, I'll need to change the position of them all, which can get tedious.

What code can I use to reset all my attributes to 100 and to change the defaults?

Bonus: To exclude specific attributes from being reset such as Mage::getResourceModel('catalog/attributes')->excludeFilter(array('color', 'size')->walk('delete');

Note: Changing the default position of a product has already been discussed. I'm looking to change the position of the attribute itself.

Manage Attributes Page

ANSWER:
Thank you saravanavelu for your pointer.

Here is the code I was looking for:

UPDATE `catalog_eav_attribute` SET `position`= 100 WHERE `attribute_id` NOT IN (130, 140, 120)

where the numbers are attribute codes. Attribute codes are found in the URL of the Edit Attribute page.

Best Answer

Try this to change the position,

//72 is description's attribute id
UPDATE `catalog_eav_attribute` SET `position`= 100 WHERE `attribute_id` = 72