Forum

Thread tagged as: Problem, Runway

No results from a collection

I've created a collection, with items that have an out of stock flag. I've put an if around the template to only display if they're in stock. If a collection effectively returns nothing due to the if is there anyway of displaying something else instead?

I thought about putting an else after the if, but it's an if per item, not an if for the whole collection.

What I really need is a check to see if the entire collection returns nothing, anyone have any ideas?

Thanks all x

Chris Comben

Chris Comben 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Probably the way to go is to use a filter rather than an if in the template. That way you can reliably paginate, and use a <perch:noresults> section to show a message when there are no results.