Copied to clipboard

Flag this post as spam?

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


  • Jinesh 15 posts 95 karma points
    Aug 21, 2015 @ 07:24
    Jinesh
    0

    Multiple level list menu problem

    I have to display multiple level menu (Main cat >SUb cat > group product) in Master page.

    Doctype hierarchy

    master -> home -> Main Category ->Sub Category -> Group Product


    i want to display 3 level list from main category to Group Product

    Content type that i made

    Home Page(type of Home) -> main category contents -> .. -> product group.


    I tried many codes but i cant got result.

    tnx in advance.

  • Jochen Schoubben 25 posts 119 karma points
    Aug 21, 2015 @ 07:45
    Jochen Schoubben
    100

    Hello Jinesh,

    Your question isn't entirely clear to me but I'll try to help you out.

    You can do the following in your cshtml file:

    @{
        var mainCategories = CurrentPage.AncestorOrSelf(1).Descendants("MainCategoryAlias");
    }
    <ul>
        @foreach (var category in mainCategories)
        {
            <li>
                @category.Name
                @if (category.Children.Any())
                {
                    <ul>
                        @foreach (var subCategory in category.Children)
                        {
                            <li>
                                @subCategory.Name
                                @if (subCategory.Children.Any())
                                {
                                    <ul>
                                        @foreach (var product in subCategory.Children)
                                        {
                                            @product.Name
                                        }
                                    </ul>
                                }
                            </li>
                        }
                    </ul>
                }
            </li>
        }
    </ul>
    

    Hope this helped you out a little!

    Kind regards,

    Jochen

  • Jinesh 15 posts 95 karma points
    Aug 21, 2015 @ 09:15
    Jinesh
    0

    Hi Jochen ,

    Got the Exact output Thanks a lot .

    Can you told me any source from that i can learn full navigation and Umbraco (ignore umbraco.tv) actually i am fresher in Umbraco and also in MVC .

  • Jochen Schoubben 25 posts 119 karma points
    Aug 21, 2015 @ 09:27
    Jochen Schoubben
    1

    Hello,

    I use the umbraco razor cheat sheet a lot: https://our.umbraco.org/projects/developer-tools/umbraco-v6-mvc-razor-cheatsheets

    For MVC information, you should take a look at the different API classes umbraco provides. However, if you are building a simple site, it won't be necessary to do this, if you need to implement forms and such, I would recommend it though. You can have a look here: https://our.umbraco.org/documentation/Implementation/Routing/MVC/

    Have fun,

    Kind regards,

    Jochen

  • 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.

Please Sign in or register to post replies