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:

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.

Was this article helpful?