Finding product type - Ecommerce - Ecommerce - Progress Community
 Ecommerce

Finding product type

  • Finding product type
  • Hi,

    In my custom product widgets that I'm building I need to apply a different template depending on the product type of the product. Once I have identified the product, how can I find out what the product type is?

    I need to be able to do something like this;
    switch(theProductType)

    case "Fruit":
    ...some code to display the fruit template
    case "Vegetable":
    ...some code to display the veg template
    ...etc.


    thanks
    Pete
  • Just to add, I can use .GetType on the product object to get something like "sf_ec_prdct_fruit" (sf_ec_prdct_generalproduct for standard products), is this the best I'm going to get?
  • Hi Nick,

    Since product types are dynamic types, you'll need to operate with the type names like the one you mentioned. However, this should not be a problem when constructing your switch statement, you just have to adjust the matching patterns to match the product types naming.

    Best wishes,
    Boyan Barnev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items