Blog Sections Open

Counting Resources by Multi-Value TV Selections in Evolution CMS

How to think about counting resources by selected TV values when one document can hold several values at once.

Catalog filters become much more useful when you can show real counts next to each option. The donor case here asked a very practical question: how do you count how many documents match each value inside a multi-value TV?

That matters whenever one resource can belong to several filter buckets at the same time and the frontend needs to display something like “Documents with this value: 14”.

The real modeling issue

Once a TV stores multiple values, simple one-field comparisons stop being enough. At that point you usually need either a custom query layer, a filtering tool that already understands the storage format, or a dedicated counting snippet.

Reasonable implementation options

  • Use a filtering package that already works with the same TV storage format.
  • Precompute counts for the listing page if performance matters.
  • Write a custom snippet when the counting rules are unique to the project.

The value of this donor is that it captures a real catalog problem, not just a code question. Counting multi-value matches is a product-listing feature, and it deserves to be treated like one.

Newer post

Pinning Selected Documents to the Top of a DocLister Listing

How to keep a normal DocLister order but force selected resources to appear at the top of the listing.

Older post

Using DocLister prepare to Build Image Paths from Resource IDs

A practical DocLister pattern for computing per-item image paths inside prepare when files follow an id-based directory layout.