Forum

Thread tagged as: Question, Runway

Sort categories by custom field

Hi,

Is it possible to sort categories by a custom field, other than the standard catID, catTitle etc? I'm running Runway 2.8.8.

My template has a select field called 'catNewProduct', with yes or no options, and another called 'catNewProductSort' to set the order of display.

My php page has:

perch_categories(array( 
'template' => 'new_products.html',
'filter' => 'catNewProduct',
'match' => 'eq',
'value' => 'Y',
'sort' => 'catNewProductSort',
'sort-order' => 'ASC',       
)); 

However, turning debug on reveals

Invalid query: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'catNewProduct' in 'where clause'

so nothing is shown.

Any pointers would be appreciated. Thanks.

Darren Neasham

Darren Neasham 1 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Categories aren't currently indexed for custom sorting. It's something we're going to look into.