Get Category Name of the product

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
2 years ago
Hello,

Can anyone suggest how do i get the category name in ProductTemplate.Simple.cshtml?
I want to check if a certain category is matched then display messages according to the category name.
2 years ago
ProductDetailsModel containts a list of category names in the Breadcrumb

In the code section at the top you could do

     var cateogryList = Model.Breadcrumb.CategoryBreadcrumb.ToList();
    foreach(var cateogry in cateogryList)
    {
        if (cateogry.Name == "Something")
        {
            // do something  
            bool test = true;
        }
    }
2 years ago
Thanks! This worked like a charm :)
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.