How to count taxonomy.findTaxonomy() results?

Hi :slight_smile:
I want to get the sum of findTaxonomy, then I try this, but it won’t work.

{% set count = taxonomy.findTaxonomy({'status':'sold'}).maxCount() %}

How is the right way to do the counting?

Thanks
Ray

The best way to resolve these sort of issues is to break them down into small steps.

  1. ensure you are getting the pages back from your findTaxonomy() call:
{{ dump(taxonomy.findTaxonomy({'status':'sold'})) }}

Look in your messages tab of the debugger (enable it first) to examine the results. If all is good, continue to step 2:

  1. this is an array of pages, so you can simply use Twig’s length filter to count them:
{{ dump(taxonomy.findTaxonomy({'status':'sold'})|length) }}

That should give you the number of found items.

Big thanks! It works now :slight_smile:
Just get start with GRAV yesterday and I’m loving it