I have added a couple of custom attributes to the catalog advanced search form, but they appear in the order you add them. With the last attribute added at the bottom of the form. I would like to change the order of form fields to make it a bit more intuitive for my visitors. How can I do this?
The advanced form in the base template is in the file
app/design/frontend/base/default/template/catalogsearch/advanced/form.phtml and it loads the attributes to show as part for a foreach loop.
It uses the function call
Mage_CatalogSearch_Block_Advanced_Form::getSearchableAttributes to load the attributes. Which intern loads a collection of attributes with the filter use in advanced search but sadly only uses attribute id as the order.
I see you have two options:
Mage_CatalogSearch_Model_Advanced::getAttributesand set your own order in the collection. You could extend the attribute table to have a new column to order attribute by.
Mage_CatalogSearch_Block_Advanced_Form::getSearchableAttributesand perform some form of processing on the attributes so that they appear in the order that you desire.
For me option 1 would be the cleanest and you could extend the system so that the admin user could specify the order they want, but it would also be the most work.