Developer forum

Forum » Ecommerce - Standard features » Wrong option name from FacetOptions

Wrong option name from FacetOptions

Kurt Moskjær Andersen
Kurt Moskjær Andersen
Reply

Hi,

I'm using facets to make a filtering option at the frontend.

The different options are taken from custom product fields, of type List, where the Facet rendertype is a Checkboxlist.

I'm using the same loop as this one https://doc.dynamicweb.com/documentation-9/how-tos/general/using-facets-to-filter-a-product-list#sideNavTitle1-5, with the only difference being checkboxes instead of a select-tag:

         @foreach(LoopItem facetGroup in GetLoop("FacetGroups")) {
             foreach(LoopItem facet in facetGroup.GetLoop("Facets")) {
                     foreach (LoopItem option in facet.GetLoop("FacetOptions"))
                     {
                        var value = option.GetValue("FacetOption.Value");
                        var selected = option.GetBoolean("FacetOption.Selected");
                        var label = option.GetString("FacetOption.Label");
                        var count = option.GetInteger("FacetOption.Count");
                        string checkedInput = "";
                        if (selected)
                        {
                            checkedInput = "checked='checked'";
                        }
                        <div>
                            <input id="@label" type="checkbox" onclick="this.form.submit();" name="@facet.GetString("Facet.QueryParameter")" value="@value" @checkedInput>
                            <label for="@label" class="">
                                @label (@count stk.)
                            </label>
                        </div>                      
                     }
             }
         }

When outputted, it seems that the Name-property of the FacetOptions is the same as the Value-property.
In the backend, the Name-property shows "Børne/Unge", with "boernungeforeninger" being the value. This is a dump of the specific FacetOptions object:

{
  "Index": 6,
  "Values": {
    "FacetOption.Name": "boernungeforeninger",
    "FacetOption.Label": "boernungeforeninger",
    "FacetOption.Sort": 0,
    "FacetOption.Value": "boernungeforeninger",
    "FacetOption.Selected": false,
    "FacetOption.Count": 28,
    "FacetOptions.LoopCounter": 6,
    "FacetOptions.LoopMod2": 0,
    "FacetOptions.LoopMod3": 0,
    "FacetOptions.LoopMod4": 2,
    "FacetOptions.LoopMod5": 1,
    "parentLoopIndex": 2
  },
  "Loops": []
}

I'm running DW 9.4.8

--
Best regards
Kurt Moskjaer Andersen


Replies

 
Oleg Rodionov Dynamicweb Employee
Oleg Rodionov
Reply
This post has been marked as an answer

Hi Kurt,

It seems to be known issue risen by the topic before, planned to implement by TFS 50469 on a further DW9 release. 

BR, Oleg QA

Votes for this answer: 1
 
Kurt Moskjær Andersen
Kurt Moskjær Andersen
Reply

Hi Oleg,

I searched the forum, but didn't find this topic. Thank you.

/Kurt

 
Jacob Storgaard Jensen
Reply

Hi Oleg, has TFS 50469 been fixed?

 
Oleg Rodionov Dynamicweb Employee
Oleg Rodionov
Reply

Hi Jacob,

50469 has been not yet implemented.

BR, Oleg QA 

 

You must be logged in to post in the forum