Developer forum

Forum » Ecommerce - Standard features » Check for NavigationShowInMenu on product groups

Check for NavigationShowInMenu on product groups

Kurt Moskjær Andersen
Kurt Moskjær Andersen
Reply

Hi,

I'm trying to check for NavigationShowInMenu in my grouplist, when showing the Ecom product groups on the frontend.

I've made an if-sentence on mygroup.GetBoolean("Ecom:Group.NavigationShowInMenu"), but even though the setting "Show in menu" is disabled on the product group in Dynamicweb, it is always False.

I'm using DW 9.5.2

--
Best regards
Kurt Moskjaer Andersen


Replies

 
Nicolai Pedersen
Reply

Can I see your entire template code related to the condition?

Thanks, Nicolai

 
Kurt Moskjær Andersen
Kurt Moskjær Andersen
Reply

Coming right up:

 

@inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>

<div class="categories">
    <div class="container">
        @{
            var groups = GetLoop("Groups");
            if (groups.Count != 0)
            {
                <div class="row">
                    @foreach (var grp in groups)
                    {
                        if (grp.GetBoolean("Ecom:Group.NavigationShowInMenu"))
                        {
                            string image = grp.GetString("Ecom:Group.LargeImage");
                            string imageResize = VestjyskMarketing.Helpers.ImageHelper.ResizeImage(image, 230, 140);
                            string groupUrl = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(grp.GetString("Ecom:Group.Link.Clean"));

                            <div class="col-xs-12 col-sm-4 col-md-3">
                                <div class="categories__item">
                                    <a class="categories__item__link" href="@groupUrl" title="@grp.GetString("Ecom:Group.Name")">
                                        <div class="categories__item__imagewrapper">
                                            <img class="img-responsive categories__item__imagewrapper__image" alt="@grp.GetString("Ecom:Group.Name")" src="@imageResize" />
                                        </div>

                                        <div class="categories__item__name">
                                            @grp.GetString("Ecom:Group.Name")
                                        </div>
                                    </a>
                                </div>
                            </div>
                        }
                    }
                </div>
            }
        }
    </div>
</div>

 

You must be logged in to post in the forum