Pagelist sorting by custom page attribute

Permalink
Hi,
i'm trying to sort a pagelist by a custom page attribute.
i'm working in a custom template controller overriding show() method
"ordinehome" is the page attribute handle, numeric.
I simply add a line before
$pages = $list->getResults();

using this line
$list->SortBy('ordinehome');
return this error:
"ORDER BY ordinehome asc' with params ["", "6", "359", "dettaglio_prodotto", 1, true, false]: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'ordinehome' in 'order clause'

using this line
$list->SortByByAttribute('ordinehome');
return this error:
SortByByAttribute method does not exist for the Concrete\Core\Page\PageList class

using this line
$list->$list->SortByOrdinehome();
return this error:
SortByOrdinehome method does not exist for the Concrete\Core\Page\PageList class

using this line
$list->SortBy('ak_ordinehome');
return no errors but had no effect

Someone can help me? it'is possible to do what i'm trying to do?

retinasnc
 
hutman replied on at Permalink Reply
hutman
Either of these should work, but be careful with the capitalization, functions are case sensitive.

$list->sortByOrdinehome();
or 
$list->sortBy('ak_ordinehome');


If you want to see what your query is resulting in use

$list->debug();