Count products of a query loop

Does anyone know how to output the count number of products in a Bricks Query Loop?

E.g. Like here
grafik

I know there is an element for it. But this works only with the element “products” and not with a query

Probably need to create a snippet for this and output with {echo:functionname}. But does anyone have an approach?

function itemnumber() { return intval( Bricks\Query::get_loop_index() + 1 ); }

{echo:itemnumber()}

This should get you started, but I can’t find any docs on this.

2 Likes