Forum

Thread tagged as: Problem, Error, Api

Filtering perch_categories using IN

Hi,

I'm having difficulty getting the perch_categories filter to work with the 'IN' match type. The error I'm getting is:

Fatal error: Call to undefined method PerchCategories_Categories::implode_for_sql_in()

and the code causing it:

                $types = perch_categories(array(
            'set'           => 'event-types',
            'filter'        => 'catID',
            'match'         => 'in',
            'value'         => $ids,
            'skip-template' => true,
            'raw'           => true
        ));

The $ids variable is a string containing '9,10'.

Perch version: (Runway) 2.7.7

James Wigger

James Wigger 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

That sounds like a bug - I'll take a look at it.

Drew McLellan

Drew McLellan 2638 points
Perch Support

It'll be fixed for 2.7.8.

Thanks Drew, in the meanwhile is there a workaround I can use? It's part of quite a critical section of the site build with a deadline coming up pretty fast.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Search in lib/PerchFactory.class.php for:

$this->implode_for_sql_in

replace with

$this->db->implode_for_sql_in

That's got it - much appreciated!