Copied to clipboard

Flag this post as spam?

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


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • Hemant 45 posts 66 karma points
    Jul 26, 2012 @ 08:49
    Hemant
    0

    Category List

    Hi all ,

    How i prepare category list using razor in Ucommerce.

     

     

    Thanks.

  • Søren Spelling Lund 1797 posts 2786 karma points
    Aug 07, 2012 @ 10:50
    Søren Spelling Lund
    0

    These methods will be useful:

    Category.GetRootCategories(catalog);

    Category.GetCategoriesForCategory(category);

    With those in hand you loop over the returned categories and prepare the HTML you want:

    @{
    var catalog = ProductCatalog.SingleOrDefault(x => x.Name == SiteContext.Current.CatalogContext.GetCurrentCatalogName && x.ProductCatalogGroup == SiteContext.Current.CatalogContext.GetCurrentCatalogGroup);
    }

    @foreach(var category in Category.GetRootCategories(catalog))
    {
    <h1>
    @category.Name
    </h1>
    }
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

    Continue discussion

Please Sign in or register to post replies