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
  • Prerequisites
  • IContentService

Was this helpful?

  1. Ucommerce Next Gen
  2. Extensions
  3. Changing Service Behavior

Content

Content is a term used to describe different types of data within a CMS. By default, content is not used anywhere in Ucommerce. By using the definition system, it can be added to any definition-driven entity, by giving it a field with the Content or ContentPickerMultiSelect data types.

To make use of content within Ucommerce, you will need to implement your content service based on the IContentService interface.

Prerequisites

Before implementing your custom content service, ensure the following:

  • External Data Source: You need access and necessary permissions to fetch and format data from an external source and into Ucommerce. If you are using a CMS, it will most likely have some form of content management API that requires authentication.

IContentService

When you implement IContentService, you will be faced with four distinct methods for retrieving and managing content.

GetContent Method

This method has two variants: one that accepts a single content ID and another that accepts a list of IDs. Both should retrieve the content associated with the specified ID(s), whether individual or multiple.

GetChildren Method

This method should retrieve all content items that have the specified content ID as their parent.

Additionally, if the ID given is null, this method should return the root level content (the content with no parent).

DownloadContent Method

This method should return a complete HTML file for the specified content input. By default, it is used in a single location: the DefaultSendConfirmationEmailPipelineTask, where it populates an email with HTML content. So if there is no need for this functionality, ignore this method and consider removing/altering that task.

All methods should fetch and filter data based on the configured external data source.

The DefaultContentService implementation built into Ucommerce already implements the DownloadContent method in a meaningful way. By inheriting from DefaultContentService instead of IContentService you can skip implementing DownloadContent and focus on overriding the other methods that the DefaultContentService does not implement in a meaningful way (it always returns a content object representing Not found).

PreviousImagesNextExtend the Backoffice

Last updated 3 months ago

Was this helpful?