Finding product type

Posted by Community Admin on 05-Aug-2018 13:57

Finding product type

All Replies

Posted by Community Admin on 14-Dec-2011 00:00
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
Posted by Community Admin on 14-Dec-2011 00:00
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?
Posted by Community Admin on 16-Dec-2011 00:00
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
This thread is closed