Developer forum

Forum » Ecommerce - Standard features » Trying to check current filter in filter-loop

Trying to check current filter in filter-loop

Kurt Moskjær Andersen
Kurt Moskjær Andersen
Reply

I'm trying to use a if-statement inside a filter-loop, like the following code.

My problem is, that the statement <!--@If(Filters:Current.TagName<contains>'dybde')--> is always false and therefore never outputs "Længde: <br>".
If I move it outside the loop, everything works fine.

Am I missing something or is it just not possible to ise it inside the loop?

 

<!--@LoopStart(Ecom:Filters.ProductFields.Rows)-->
    <!--@HeaderStart-->
    <div class="form__group">
        <label class="form__label">
            <!--@If(Global:Pageview.Url<contains>'Kileremme')-->
                <!--@If(Filters:Current.TagName<contains>'dybde')-->
                    Længde:<br />
                <!--@Else-->
                    <!--@Filters:Current.Name-->:<br />
                <!--@EndIf-->
            <!--@Else-->
                <!--@Filters:Current.Name-->:<br />
            <!--@EndIf-->
            <select name="<!--@Filters:Current.TagName-->" class="selectFilter form__input">
                <option value="">Vælg</option>
                <!--@HeaderEnd-->
                <option class="filterDropdown" _d="item<!--@Ecom:Filters.ProductFields.Rows.LoopCounter-->" _name="<!--@Filters:Current.TagName-->" value="<!--@Ecom:Filters.ProductFields.Row.Value-->" <!--@If Defined(Ecom:Filters.ProductFields.Row.CheckedState)--> selected="selected"<!--@EndIf(Ecom:Filters.ProductFields.Row.CheckedState)-->>
<!--@Ecom:Filters.ProductFields.Row.Text-->&nbsp;<span>(<!--@Ecom:Filters.ProductFields.Row.TotalFormatted-->)</span>
</option>
                <!--@FooterStart-->
            </select>
        </label>
    </div>
    <!--@FooterEnd-->
    <!--@LoopEnd(Ecom:Filters.ProductFields.Rows)-->
 
Best regards
Kurt Moskjaer Andersen

Replies

 
Nicolai Pedersen
Reply
This post has been marked as an answer

You cannot inside the loop in html templates because scope for that tags gets wrong.

I would change the template to Razor for stuff this 'complicated'

BR Nicolai

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

Hi Nicolai,

Thank you for your answer. Well, I'll convert it to Razor.

Best regards
Kurt Moskjaer Andersen

 

You must be logged in to post in the forum