Introduction
Manage e-commerce products with dynamic catalogs, filtering, and search.
π― What does this module do?β
The Products module (Catalog) is a standalone module that lets you create, retrieve, filter, and manage products in your online store or multimedia collections. It provides very flexible tools for creating product catalogs or multimedia galleries with powerful search, filters, and organization features.
The Catalog enables creating, uploading, editing, and filtering catalogs through an intuitive interface. Beyond e-commerce, it supports alternative applications like multimedia galleries, demonstrating its versatility as a content management tool.
Think of it as your digital warehouse - you manage your product inventory in OneEntry admin panel (Catalog > Products), and your app fetches products dynamically with powerful search, filters, and sorting.
π Simple Explanationβ
Imagine you're building an online store selling:
- π Sneakers - with sizes, colors, prices
- π± Electronics - with specs, images, reviews
- π Clothing - with sizes, materials, variants
- π Books - with authors, prices, descriptions
β Instead of hardcoding each product, you:
- Add products in OneEntry admin panel (with all details)
- Fetch products dynamically using this module
- Filter by category, price range, availability
- Search products by name or description
- Sort by price, date, popularity
- Update prices/stock without redeploying
Real-world example:
β Without Products Module (hardcoded):
- Add new product β Change code β Deploy
- Change price β Code change β Deploy
- 1000 products = massive code file
β
With Products Module (dynamic):
- Add new product β Update in admin β Live instantly
- Change price β Update in admin β Live instantly
- 10,000 products = simple API calls
β¨ Key Conceptsβ
What is a Product?β
A product is an item you sell, containing:
- Basic info - Name, description, SKU, price
- Images - Product photos, gallery
- Variants - Sizes, colors, options (e.g., "Red T-shirt Size M")
- Inventory - Stock quantity, availability
- Custom attributes - Any fields you define (brand, material, weight, etc.)
- SEO - Meta title, description, keywords
- Status - Active, draft, out of stock
- Localization - Multi-language support
Product Structureβ
Products can have different structures:
| Type | Description | Example |
|---|---|---|
| Simple Product | Single item, no variants | Book, Poster |
| Product with Variants | Multiple options (size, color) | T-shirt (S/M/L, Red/Blue) |
| Digital Product | Downloadable items | E-book, Software |
| Bundle | Group of products | Starter Pack, Gift Set |
Product Organizationβ
Products are organized through several key features:
- Categories - Organize into sections (Categories are pages of the Catalog type created in Pages module)
- Product Statuses - Create additional filtering conditions beyond existing attribute filters
- Product Links - Establish connections between products based on attribute criteria
- Product Filters - Quick searching using specified filter criteria
- Custom attributes - Brand, Size, Color, Material, etc.
Example hierarchy:
π Electronics
ββ π± Smartphones
β ββ iPhone 15 Pro
β ββ Samsung Galaxy S24
ββ π» Laptops
ββ MacBook Pro
ββ Dell XPS
π Clothing
ββ π T-Shirts
ββ π Jeans
π What You Need to Knowβ
Catalog Architectureβ
Important: Categories of the catalog are pages of the Catalog type created through the Pages module. You need to create catalog categories first before adding products.
Catalog features:
- Products Tab - Main workspace for creating and managing catalog items
- Product Filters - Quick searching using specified criteria
- Product Links - Connect products based on attribute criteria (e.g., all black phones)
- Product Statuses - Additional filtering conditions for organization
- Catalog Upload - Bulk importing catalog data
- Settings - Configuration options with numeric input fields
Ways to Get Productsβ
| Method | When to Use | Example |
|---|---|---|
| getProducts() | List products with filters/search | Shop catalog page |
| getProductsByPageId() | Products from specific category (by ID) | Category page |
| getProductsByPageUrl() | Products from specific category (by URL) | Category page by URL |
| getProductById() | Get single product by ID | Product detail page |
| getRelatedProductsById() | Get related/similar products | "You may also like" section |
| searchProduct() | Search products by query | Search functionality |
Pagination Explained Simplyβ
When you have 1000 products, you don't load all at once:
Offset formula: offset = (pageNumber - 1) * limit
Sorting Optionsβ
Sort products by different fields:
| sortKey | What It Does | Example Use |
|---|---|---|
| price | Sort by price | Show cheapest first |
| date | Sort by creation date | Show newest products |
| title | Sort alphabetically | A-Z product list |
| position | Custom order (default) | Hand-picked order from admin |
| id | Sort by ID | Technical sorting |
Sort order:
- ASC (Ascending) - Low to high (AβZ, 0β9, cheapβexpensive)
- DESC (Descending) - High to low (ZβA, 9β0, expensiveβcheap)
Filtering Productsβ
Use filters to narrow down results:
Condition markers:
| Marker | Meaning | Example |
|---|---|---|
| eq | Equal (exact match) | Price = $50 |
| neq | Not equal | Status β "sold out" |
| in | Contains (one of) | Color in ["red", "blue"] |
| nin | Not contains | Category not in ["archived"] |
| mth | Greater than | Price > $100 |
| lth | Less than | Price < $50 |
| exs | Exists (has value) | Has discount |
| nexs | Does not exist (empty) | No discount |
Product Status and Linksβ
Product Statuses create additional filtering conditions beyond existing attribute filters for more sophisticated product organization.
Product Links allow establishing connections between products based on attribute criteria. For example, you can link all products with the same color attribute (e.g., all black phones together).
π Quick Reference Table - Common Methodsβ
| Method | Description | Use Case |
|---|---|---|
| getProducts() | Get all products with filtering/sorting | Main catalog page |
| getProductById() | Get single product by ID | Product detail page |
| getProductsByPageId() | Get products from category by page ID | Category page |
| getProductsByPageUrl() | Get products from category by page URL | Category page by URL |
| getRelatedProductsById() | Get related/similar products | "You may also like" section |
| searchProduct() | Search products by query | Search functionality |
| getProductsCount() | Get total products count | Pagination info |
| getProductsCountByPageId() | Get products count by category ID | Category pagination |
| getProductsCountByPageUrl() | Get products count by category URL | Category pagination |
| getProductBlockById() | Get product block by ID | Product content blocks |
| getProductsEmptyPage() | Get products empty page structure | Empty state handling |
| getProductsPriceByPageUrl() | Get product prices by page URL | Price filtering |
β Common Questions (FAQ)β
Can I filter by multiple criteria at once?β
Yes! Combine multiple filters in array.
How do I handle product variants (sizes, colors)?β
Product variants are stored in attributeValues.
How do I implement "Load More" button?β
Use offset to load more products.
Can I show products from multiple categories?β
Yes, use category in condition marker.
How do I implement "New Arrivals" section?β
Sort by creation date or use parent category for manually sorting.
π‘ Important Notesβ
Catalog Categories Setupβ
Important: Before adding products, you must create catalog categories through the Pages module. Categories of the catalog are pages of the Catalog type.
Workflow:
- Go to Pages module in admin panel
- Create pages with "Catalog" type
- These pages become your product categories
- Add products to these categories via Catalog > Products
Catalog Featuresβ
The Catalog module provides comprehensive tools:
- Products Tab - Main workspace for creating/managing catalog items
- Product Filters - Enable quick searching using specified criteria
- Product Links - Connect related products based on attributes
- Product Statuses - Create custom filtering conditions
- Catalog Upload - Bulk import products
- Settings - Configure catalog behavior
Beyond E-commerceβ
The Catalog isn't limited to products - it can be used for:
- Multimedia Galleries - Photos, videos, artwork collections
- Portfolio Items - Design work, case studies
- Document Libraries - Resources, downloads
- Event Catalogs - Conferences, webinars
- Recipe Collections - Food, drinks, cooking
Performance Optimizationβ
Cache frequently accessed products to reduce API calls and improve load times.
Always Filter Active Productsβ
In production, always show only active products by filtering with statusId: 1.
Handle Missing Imagesβ
Provide fallback images for products without images to maintain consistent UI.
π Best Practicesβ
- Always use pagination (limit + offset)
- Filter by
statusId: 1in production - Cache product lists to reduce API calls
- Handle "out of stock" gracefully
- Provide fallback images
- Use markers for featured products (not IDs)
- Implement search with debouncing
- Add loading states in UI
More information about the Catalog in the OneEntry admin panel: https://doc.oneentry.cloudhttps://doc.oneentry.cloud/docs/category/catalog
Definition of the Products moduleβ
const { Products } = defineOneEntry( "your-project-url", { "token": "your-app-token" });
This module accepts a set of user parameters called userQuery. If the parameters are not passed to the method, the default value will be applied. Some methods accept the body as a parameter for filtering. If you don't want to set up sorting, pass an empty array or don't pass anything.
Parameters:
const userQuery = { offset: 0, limit: 30, sortOrder: 'DESC', sortKey: 'id',}
Schema
offset: number
Pagination parameter. Default 0
example: 0
limit: number
pagination parameter. Default 30
example: 30
sortKey: string
Field for sorting (default not set - sorting by position, possible values: id, title, date, price, position)
Available values: id, position, title, date, price
sortOrder: string
sorting order DESC | ASC (default DESC)
example: "DESC"
By default, you can retrieve 10 objects. This is due to the record limit in the module's permissions settings.
For pagination to work correctly, you need to configure Module permissions according to your needs in the corresponding section.
"conditionMarker" by which values are filtered (not set by default), possible values:
'in' - Contains,
'nin' - Does not contain,
'eq' - Equal,
'neq' - Not equal,
'mth' - Greater than,
'lth' - Less than,
'exs' - Exists,
'nexs' - Does not exist