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.

  • Kim Rasmussen 80 posts 307 karma points
    Jun 26, 2015 @ 13:28
    Kim Rasmussen
    0

    Multiple catalogs - how to show categories in navigation?

    I'am trying to get uCommerce up and running, but having trouble with the structure. I have 3 catalogs with multiple categories.

    What I'am trying to make is a normal drop-down navigation with catalogs and other content pages, and their subpages / categories. Below is listing the catalogs, but not their categories ...

    List<ProductCatalog> catalogs = UCommerce.Api.CatalogLibrary.GetAllCatalogs();
        foreach (ProductCatalog productCatalog in catalogs)
        {
            <h1>@productCatalog.Name</h1>
    
            @foreach (Category categories in productCatalog) // does not work!
            {
                <h2>Category display name</h2>   
            }
        }
    

    Any ideas?

    Best regards Kim

  • Martin 181 posts 740 karma points
    Jun 26, 2015 @ 18:37
    Martin
    100

    Hi Kim,

    When doing your foreach you should foreach over the property Categories in productCatalog or use the GetRootCategories method. So your foreach should look like this instead:

    @foreach (Category categories in productCatalog.GetRootCategories())
    

    Best regards Martin

  • Kim Rasmussen 80 posts 307 karma points
    Jun 29, 2015 @ 06:15
    Kim Rasmussen
    0

    Hi Martin,

    Thanks - that worked :)

    Best regards

    Kim

Please Sign in or register to post replies

Write your reply to:

Draft