Forum

Thread tagged as: Question, Runway

Can I filter on specific category items

Hi, Hoping someone can help me. I am trying to populate a secondary drop down based on the choice of another drop down but if I attempt to apply filtering to the specific category I get nothing returned. Am I doing something wrong or is the following even possible?

<?php
include($_SERVER['DOCUMENT_ROOT'].'/perch/runtime.php');
$sectorID = $_POST['sectorID'];

$subSectors = perch_categories([
                'set' => 'sectors',
                'template' =>'ajax-sub-sectors.html',                
                'filter' => [
                    [
                        'filter' => 'catSectorID',
                        'match'  => 'eq',
                        'value'  => $sectorID,
                    ],
                    [
                        'filter' => 'catSubSectorID',
                        'match'  => 'neq',
                        'value'  => 0,
                    ],
                ]             
            ]);            

echo $subSectors;

?>

Many thanks

Lee Goodman

Lee Goodman 0 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Categories can't be filtered by custom fields at the moment. It's definitely something we're planning on changing. It got bumped from 3.0.0 but it's coming.

Thanks Drew - I will have to a workaround for now.