Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Joe Morrison 20 posts 80 karma points
    Mar 14, 2013 @ 14:55
    Joe Morrison
    0

    uCommerce Get Category definition boolean

    Hey guys, I was wondering if it was possible to get whether a category property is checked (true/false) in uCommerce (using V2)

    The code as follows simply brings back true that the Category has that name, which is fine, but I want to find out whether the checkbox with that name is checked or not?

    var myCategory = Category.All().Single(x => x.CategoryId == 147);
    var count = 0;

    foreach (Category subCat in myCategory.Categories.Where(i => !i.Deleted && i.DisplayOnSite && i.GetDefinition().GetDefinitionFields().SingleOrDefault(x => x.Name == "DisplayOnNav")))
    {
    //do stuff
    count++
    }
  • Joe Morrison 20 posts 80 karma points
    Mar 14, 2013 @ 14:58
    Joe Morrison
    0

    Basically from the code above I want to find out if x.Name == "DisplayOnNav" is checked!

  • Joe Morrison 20 posts 80 karma points
    Mar 14, 2013 @ 17:09
    Joe Morrison
    100

    Anyone who comes across this, i finally found a way to do it by getting the definitionfield id

     && i.CategoryProperties.SingleOrDefault(x => x.DefinitionFieldId == 3).Value.ToString() == "True"
Please Sign in or register to post replies

Write your reply to:

Draft