Developer forum

Forum » Development » ProdCatalog combine filter with navigation

ProdCatalog combine filter with navigation

Dmitrij Jazel
Reply

Hi Guys,

I am trying to combine filters with Navigation, I am actually using Group filter.

And I have 2 levels of navigation in catalog structure so I have Parent level and Child level, easy as that :)

 

Products are populated only in children.

 

What I was surprised to see - is that if you navigate to group for example GroupID=Group1

Than ammount of @i2.GetString("Ecom:Group.TotalFormatted") regurns "0" as soon as I navigate to the ProdGroup, filters are not rendering data from that groups perspective.

 

Here is a filter code that can give you some idea of what I am trying to achieve here:

<div id="groups-filter" class="filterControls panel" >
    <h3>
        Categories
    </h3>
    <ul>
    @foreach (LoopItem i in GetLoop("Ecom:Filters.Groups"))
    {               
        string groupURL = "http://site.localtest.me/Products.aspx"+"?GroupID="+i.GetString("Ecom:Group.ID");
            <li class="">
                <a href="@groupURL">@i.GetString("Ecom:Group.Name")</a>
            </li>
    }
    </ul>
</div>


@foreach (LoopItem i in GetLoop("Ecom:Filters.Groups"))
{
    string parentGroupID = i.GetString("Ecom:Group.ID");
    if (!alreadyRenderedChildren.Contains(parentGroupID))
    {
        <div id="groups-filter" class="filterControls panel">
    
        <h3>
            @i.GetValue("Ecom:Group.Name")
        </h3>

        <ul>
            @foreach (LoopItem i2 in i.GetLoop("Ecom:Group.ChildGroups"))
            {
                string childGroupID = i2.GetString("Ecom:Group.ID");
                alreadyRenderedChildren.Add(childGroupID);
                <li class="">
                    <input type="checkbox" id="@i2.GetString("Ecom:Group.ID")" name="@i2.GetString("Filters:Current.TagName")" value="@i2.GetString("Ecom:Group.ID")" @i2.GetString("Ecom:Group.CheckedState") />
                    <label for="@i2.GetString("Ecom:Group.ID")">
                        @i2.GetString("Ecom:Group.Name")&nbsp;<span>(@i2.GetString("Ecom:Group.TotalFormatted"))</span>
                    </label>
                </li>
            
            }
        </ul>
    </div>
    }
}

Any way I can make those filters render information depending on which group I navigated to?

 


Replies

 

You must be logged in to post in the forum