I am trying to sort a product collection by an attribute that is of the 'select' type with lots of option values, all of which have sort order positions set. My attribute is called 'style'.

When I set my product collection to sort by the attribute I do get it sorted by that attribute, albeit alphabetically, not as per the position values.

    $collection = $this->_addProductAttributesAndPrices($collection)
        ->addAttributeToSort('style', 'asc')

This sorts the products alphabetically by style name (not style sort order values).

I have tried really hard to try to work out how to fix this.

As an added complication I am using 'flat tables' in the frontend.

Any ideas?

1 Answer 1


Try with style_value instead of style,if flat table is enable.

  • Thanks but the style_value is the option values, not the option sort order values, therefore it still sorts alphabetically. Apr 21, 2016 at 13:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.