Remove sorting on attributes

Sven

No avatar

2005-05-22 20:56

Is there any way to remove sorting on attributes in the dropdownlist?
For example sizes Small, Medium, Large, X-Large shows like:
Large, Medium, Small, X-Large

I tried removing the sort parameter in file:
plugins/productAttributes/attributes-ff.php

row:
return $GLOBALS['oFF']->throwFileArray( DIR_DB.DB_ATTRIBUTES, 'sort' );

It didn't really work ;-)

Wizzud

No avatar

2005-05-23 08:54

The sort is there because the attributes have to be grouped by Attribute Group otherwise the assignment to their correct dropdown gets screwed up. So the sort is used to make sure that his happpens, otherwise if you added 4 original Colours, then some Sizes, then another Colour, the final Colour would get its own dropdown and form field names and ids would be screwy.
Removing the sort will only work if your attributes (in the db/attributes.php file) are listed in Group order AND WILL NOT BE CHANGED via Admin. Then the attributes will be returned in the order they appear in the file.
There is an array_multisort call in PHP that will sort arrays of arrays (which this is) but it requires some data manipulation to start with so you can't just plug it in in place of 'sort'.

Sven

No avatar

2005-05-24 12:00

Tthe first field in db/attributes.php in groupname and the second field is attribute name.
I'm thinking of a way to remove sorting after the first field. So that only field one gets sorted... Maybe I have to learn php and I'l code it ;-)

Sven

No avatar

2005-05-24 15:48

Of course I mean sorting the hole row by looking only at first column :-)

Back to top
about us | contact