Forum

Thread tagged as: Question

Sort by Checkbox

I have the following code:

perch_content_custom ('Properties Listing', array (
    'sort' => 'sold',
    'sort-order' => 'DESC'
) );

'sold' is a checkbox within the multiple content template.

I am trying to order the items by the value of 'sold' , from 0 to 1, or checked to unchecked, but when I use the code above, only the sold properties are display, I've tried using 'sort-type' and mixes of 'filter' but none of these return entries where the checkbox 'sold' is not checked.

Does anyone know if it is possible to sort by checkbox value?

Running version: 2.4.9

Bob Gentle

Bob Gentle 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

It's not possible currently, as null items aren't added to the search index.

Thanks, would these kinds of indexing be handled in Runway when it is launched?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Hopefully we'll get it fixed for Perch.

Drew McLellan

Drew McLellan 2638 points
Perch Support

I think this should now be fixed in 2.5.2. I've made an attempt at it, anyway. You may need to re-save your region.