I am trying to develop a generic item type for displaying a product or product category field.
I have defined an item type with a "Product Field" (Drop down) and Style field (Text), and created the follow SQL Query as the source for the dropdown
SELECT concat(FieldCategoryId, '->', FieldId) as Label,
concat(FieldCategoryId, ':', FieldId) as Value
This will get all the non-reference fields for product categories, split the category and field name on the " : ", and allow someone to simply select which field they want when dropping the item type into a page with a product catalog app. ( fieldValue = product.ProductCategories[FieldCategoryId].Fields[FieldId].Value.ToString(); )
I am not sure how to do this dynamically for the system types, as these can be simple fields in the ecom_products table (price), or complex types (Manufacturer) spanning multiple tables.
So I cannot just do a
fieldValue = product.ProductCategories[FieldCategoryId].Fields[FieldId].Value.ToString(); as I intend to do with the product category fields.
Does anyone have any tips on how to enumerate and display the built-in types in a generic way?
I really dont want to have to do in the template, a massive switch with 200 'case "FieldName": value = path.in.view.model.to.name;'