Ucommerce
  • Ucommerce Next Gen
    • Getting Started
      • Prerequisites
      • Licensing
      • Ucommerce Templates
      • Headless Template
      • MVC Template
    • Headless
      • Postman Collection
      • Headless API Authentication
        • Token endpoint - Authorization Header
        • Authorization Scopes
        • Refreshing the Access Token
      • Reference
        • Cart
        • Cart / Order Line Items
        • Shipment
        • Billing
        • Promotion Codes
        • Price Groups
        • Payment Methods
        • Countries
        • Shipping Methods
        • Catalogs
        • Cart Custom Properties
        • Line Item Custom Properties
        • Orders
        • Views for Cart modifying operations
      • Custom Headless APIs
      • Error Handling
      • Pagination
      • Deprecation
    • Backoffice Authentication
      • Microsoft Entra ID Example
      • Auth0 Authentication Example
    • Definitions
      • What is a Definition
    • Search and indexing
      • Configuration
      • Indexing
        • Index Definitions
        • Facets
        • Indexing Prices
        • Suggestions
        • Custom Data
      • Searching
    • Payment Providers
      • Stripe Provider Integration
      • Implementing a custom payment provider
    • Data Import
    • Miscellaneous
      • Media
      • Price Group Inheritance
      • Price Group Criteria
      • Soft Deletion Of Entities
      • Logging
      • OpenTelemetry
    • Extensions
      • Extending Pipelines
        • Order Processing Pipelines
        • Checkout Pipelines
      • Changing Service Behavior
        • Images
        • Content
      • Custom Headless APIs
      • Extend the Backoffice
        • Custom UI Components
      • Custom Editor UI
      • Custom Promotion Criteria
      • Custom Price Group Criteria
    • How-To
      • Migrate from Classic
        • Common database issues
      • Entities from code
        • Bootstrapping data on startup
        • Product Definitions & Fields
      • Discover pipelines and their tasks
      • Executing a pipeline
    • Integrations
      • Umbraco Media Delivery API
      • App Slices
        • Product Picker
  • Release Notes
  • Contact Us
Powered by GitBook
On this page
  • Definition Fields
  • Multilingual Fields
  • Display on Site
  • Render in Editor
  • Data Type
  • Converting (string) field values to numbers
  • Variant property (products only)
  • Composable Definitions

Was this helpful?

  1. Ucommerce Next Gen
  2. Definitions

What is a Definition

The idea behind definitions is to enable saving additional information, tailored to your specific needs, for each entity.

Consider the following scenario: You sell shirts and shoes in the store. To do that you need information about sizes and colors on your products.

The solution is simple - Ucommerce supports definitions, to which new fields can be added to store the information you need. You might already be familiar with the concept of Document Types in Umbraco or Templates in Sitecore. A definition in Ucommerce is basically the same thing but for e-commerce.

Definition Fields

Definitions have a list of fields, which are available to the store manager to maintain in the back office. For the Shirt definition, you can have two fields available: Color and Size. For the Shoe definition, you can have one field available: Size.

Each field has a number of configuration options, which influence the look and functionality in the back office UI. They will be covered in detail in the next sections.

Multilingual Fields

If you need to maintain the data of the field in multiple languages, you can mark the field as being multilingual. This will allow you to define a value per language configured.

Display on Site

A true/false value which is set on the field to indicate whether to display the field on the website. If set to false, the field will not be part of the search index.

Render in Editor

Sometimes you need data you don’t want the back office user to edit. Setting this property to false will exclude the field from the back office UI, effectively making the field accessible via code only.

Data Type

Each field has an associated data type, which determines the editor for the particular field, e.g. a checkbox, text box, date picker, etc. Ucommerce comes with a number of built-in data types such as ShortText, LongText, Number, Boolean, Enum, and Image. Enum is a special type that enables you to predefine a list of values for the back office user to select from, e.g. colors or sizes. Basically data with a finite number of options to choose from.

Validation Expression

A data type can have a validation expression associated with it to validate user input when editing in the back office. A validation expression is a standard regular expression evaluated whenever a field of the given type is saved.

Converting (string) field values to numbers

Given the flexible nature of the definition system, field values are always stored as strings. When a definition field is of type Number you can use the extension methods ToDecimal(), ToFloat(), and ToDouble() built into Ucommerce, to make sure the value is converted using the same culture Ucommerce uses when storing the value as a string. The extension methods are found in the namespace Ucommerce.Web.Common.Extensions .

Variant property (products only)

When creating a definition field on a product, you can decide whether it is a variant field, or not. This will change the definition field from appearing on the parent product, or on the product variant.

Composable Definitions

A definition can inherit from other definitions, which enables you to build your definitions in a composable way. Add fields that are common across multiple definitions, in a single definition and reuse it as a parent for other definitions, e.g. SEO information is something you want to store on all products and categories regardless of their various definitions so the shirts, shoes, and accessories definitions all inherit from the SEO definition.

The result is less work when defining new fields as shared fields can be added once and "mixed" in with the relevant definitions.

Ucommerce supports inheritance from multiple parents, which means a single definition may inherit from multiple other definitions, e.g. the Shoe definition might inherit fields from both the SEO and Footwear definition.

PreviousDefinitionsNextSearch and indexing

Last updated 1 month ago

Was this helpful?