Ana içeriğe geç

Introduction

Build navigation and faceted filtering from a single, localized content filter tree.

More information about the module's user interface https://doc.oneentry.cloud/docs/category/filters


🎯 What does this module do?

The Filters module lets you retrieve a content filter by its marker. A content filter is a curated, localized tree of items - it can mix pages, products, attributes, discounts, bonuses, payment methods and custom entries in a single structure.

Think of it as a configurable menu of "things to filter by" - you define the tree once in the OneEntry admin panel and pull it into your app to render navigation, faceted filters or curated lists.


📖 Simple Explanation

A content filter is a tree where each node points to something in your project:

  • 📄 page - a link to a page (has a url)
  • 🛍️ product - a product entry
  • 🏷️ attribute - an attribute to filter by
  • 💸 discount / personal-discount - a discount entry
  • 🎁 bonus - a bonus entry
  • 💳 payment-method - a payment method
  • ✏️ custom - a custom entry you defined

Each node carries localized info and may contain nested children, so you can render multi-level filters and menus directly from the response.


✨ Key Concepts

Marker

Every filter has a unique marker (for example main). You request a filter by marker, and the response is localized to the requested language code.

Items tree

The items array is a tree: regular and custom items live in the same array, and each node can have children. Walk the tree to render your UI.


📋 What You Need to Know

  • Pass a langCode to get the filter localized to a specific language (defaults to en_US).
  • Page nodes (type: "page") expose a url; other node types use marker to reference their entity.
  • The value field carries a unified node value (for example a discount value or an attribute title) when applicable.

📊 Quick Reference Table

MethodDescription
getFilterByMarker()Get a content filter by its marker

❓ Common Questions (FAQ)

Where do content filters come from?

Content filters are configured in the OneEntry admin panel. The SDK retrieves them read-only by marker.


How do I render a multi-level filter?

Recursively walk the items array - each node may contain a children array with the same node shape.


🎓 Best Practices

  • Reference filters by marker, never by a display title.
  • Request the filter in the user's current language via langCode.
  • Cache filters - they change rarely.

Definition of the Filters module


const { Filters } = defineOneEntry(
"your-project-url", {
"token": "your-app-token"
}
);