Speed up widget development with Sitefinity MCP server. Learn more...

Query custom fields for product types

Query a single custom field

To query a single custom field, you must perform the following:

  1. Get an instance of the ecommerce manager.
    Get an instance of the EcommerceManager object. 
  2. Get the specified product type.
    Get an instance of the product type that the field belongs to. For more information, see For developers: Query product types.
  3. Resolve the product CLR type.
    To resolve the product CLR type, call the static ResolveType method of the TypeResolutionService. As an argument use the value of the ClrType property of the ProductType instance.

    NOTE: To use the ResolveType method to resolve the dynamic product type, you must make sure that you have instantiated the CatalogManager before that. In this example the CatalogManager is instantiated in order to get the product type.

  4. Get an instance of the metadata manager.
    Get an instance of the MetadataManager object.
  5. Get the meta type for the specified product type.
    To get the meta type, call the GetMetaType method of the metadata manager and pass the resolved product CLR type as an argument.
  6. Get the specified field.
    Filter the Fields collection of the MetaType instance by the name of the field.

Use the following code sample:

Query custom fields by a product type

To query a single custom field, you must perform the following:

  1. Get an instance of the ecommerce manager.
    Get an instance of the EcommerceManager object.
  2. Get the specified product type.
    Get an instance of the product type that the field belongs to. For more information, see For developers: Query product types.
  3. Resolve the product CLR type.
    To resolve the product CLR type, call the static ResolveType method of the TypeResolutionService. As an argument use the value of the ClrType property of the ProductType instance.

    NOTE: To use the ResolveType method to resolve the dynamic product type, you must make sure that you have instantiated the CatalogManager before that. In this example the CatalogManager is instantiated in order to get the product type.

  4. Get an instance of the metadata manager.
    Get an instance of the MetadataManager object.
  5. Get the meta type for the specified product type.
    To get the meta type, call the GetMetaType method of the metadata manager and pass the resolved product CLR type as an argument.
  6. Get the fields.
    The fields are stored in the Fields collection of the MetaType instance.

Use the following code sample:

NEW TO SITEFINITY?

Want to learn more?

Enhance your Sitefinity skills by enrolling in free training sessions. Become Sitefinity certified through Progress Education Community to strengthen your professional credentials.

Get started with Integration Hub | Sitefinity Cloud

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 your 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 ASP.NET Core and take advantage of its decoupled architecture and modern development model.

Was this article helpful?