Create products

To create a product, you must perform the following:

  1. Get an instance of the CatalogManager object.
  2. Check if the product already exists.
    To check if the product already exists, make a query for a product with the same name and check if it returns null.
  3. Get the product type.
    Get an instance of the product type that the product is associated with. You cannot create product without specifying its product type.
  4. Create a new product.
    To create a new product type, call the CreateProduct method of the manager and pass the CLR product type as an argument.
  5. Set the properties of the product.
    You must set at least the following properties:
    • Title
    • IsActive
    • Sku
    • UrlName
    • ClrType
  6. Set the status of the product.
    Set the Status property of the product to GenericContent.Model.ContentLifecycleStatus.Master.
    This is the master version of the product, which you use when you modify the product. When you publish the product, you are creating a live version. For more information, see For developers: Content lifecycle.
  7. Recompile the URLs of the product.
    To recompile the URLs of the product, call RecompileItemUrls and pass the product as an argument.
  8. Save the changes to the catalog manager.
  9. Publish the product.
    To publish the product, call the MessageWorkflow method of the WorkflowManager class and pass the required arguments as shown in the example below.
    This creates a live version of the product that is displayed in the frontend.
  • Code example: Create a product

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?

Next article

Query products