Thread tagged as: Question

I can't get 'filter by related items' working?



I've got a collection called Staff and I'm using perch:related to link it to another collection called Solutions

I'm using this in my Solutions collection template

<perch:related id="staff_related" collection="Staff" label="Staff">
    <perch:content id="staff_name" type="text">, 
    <perch:content id="staff_position" type="text"> 

This is the detail template I'm using in my Staff collection

<perch:content id="staff_name" title type="text" label="Name">       
<perch:content id="staff_position" type="text" label="Position">

When adding new items to the Solutions collection the perch:related option shows up in Perch Admin - this bit works fine.


I'd like to filter by related items as described in the docs. Here's what I'm using on my solutions.php page.

    'filter' => 'staff_related.staff_name',
    'match' => 'eq',
    'value'  => 'Janet Thompson',
    'template' => 'staff-detail.html'

The filter uses the dot syntax method, perch:related ID followed by the perch:content ID I want to filter on.

I've hardcoded the value, the fictional Janet Thompson is present in the Staff collection

When I refresh the page, all I see is are the words THIS IS A TEST from the staff-detail.html template.

It's not picking up id="staff_name" or id="staff_position"

I've checked perch_debug and php_error.log no errors in either.

Any ideas why?

Perch Runway: 3.1.1, PHP: 7.1.12, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: b396954eeb2d1d9ed7902b8bae237b287f21ad9e $, with PDO
Server OS: Darwin, cgi-fcgi
Installed apps: content (3.1.1), assets (3.1.1), categories (3.1.1)
App runtimes: <?php $apps_list = [ ];
PERCH_PATH: /Users/stephen/Repositories/project/cms/perch
PERCH_CORE: /Users/stephen/Repositories/project/cms/perch/core
PERCH_RESFILEPATH: /Users/stephen/Repositories/project/cms/perch/resources
Image manipulation: GD
PHP limits: Max upload 32M, Max POST 32M, Memory: 128M, Total max file upload: 32M
F1: 3b606135b33e6a102526838f4152a807
Resource folder writeable: Yes
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
REQUEST_URI: /perch/core/settings/diagnostics/
DOCUMENT_ROOT: /Users/stephen/Repositories/project/cms
HTTP_HOST: project.local
Stephen Meehan

Stephen Meehan 4 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

No, I've no idea why. Have you turned on debug?