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) ->addStoreFilter() ->addAttributeToSort('style', 'asc') ->setPageSize($this->getProductsCount()) ->setCurPage(1) ;
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.