page_list sort by custom number attribute

Permalink
is it possible in the page_list to search by a custom attribute
i am using version 5.7.2
i already tried:
$pl->sortByAttribute('order', 'asc');

 
MrKDilkington replied on at Permalink Best Answer Reply
MrKDilkington
Hi aryeh,

Try this example
// sort pages by the custom attribute handle "event_date_time" in ascending order
// the custom attribute handle is prefixed with "ak_"
$pl->sortBy('ak_event_date_time', 'asc');
aryeh replied on at Permalink Reply
does not work!
aryeh replied on at Permalink Reply
this is the error i am getting:
An exception occurred while executing 'SELECT p.cID FROM Pages p LEFT JOIN PagePaths pp ON (p.cID = pp.cID and pp.ppIsCanonical = true) LEFT JOIN PageSearchIndex psi ON p.cID = psi.cID LEFT JOIN PageTypes pt ON p.ptID = pt.ptID INNER JOIN Collections c ON p.cID = c.cID LEFT JOIN CollectionSearchIndexAttributes csi ON c.cID = csi.cID INNER JOIN CollectionVersions cv ON p.cID = cv.cID and cvIsApproved = 1 WHERE (ak_is_featured = ?) AND (cv.pTemplateID = ?) AND (p.cPointerID < 1) AND (p.cIsTemplate = 0) AND (p.cIsActive = ?) AND (p.cIsSystemPage = ?) ORDER BY ak_event_date_time asc' with params [1, 11, true, false]: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'ak_event_date_time' in 'order clause'
mkly replied on at Permalink Reply
mkly
$pl->sortBy('csi.ak_event_date_time', 'asc');
aryeh replied on at Permalink Reply
nop! did not work. anything else?
aryeh replied on at Permalink Reply
i am trying to sort by a custom attribute with a type number with a handle "order"
so i need: $pl->sortBy('csi.order', 'asc'); like you said and it did not work.
aryeh replied on at Permalink Reply
my mistake forgor to put in ak_ thank you.