Developer forum

Forum » Ecommerce - Standard features » Changing sort order of filters

Changing sort order of filters

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

It seems that filters are always shown in alphabetical order, and not the order they are defined in in the backend. Is there a way to override this default sort order?

Thanks,

Imar


Replies

 
Thomas Schroll
Reply

Hi

If you use the filter tag and insert the filters in the search template like this:

<form name="EcomSearch" class="form-filters" method="get" action="/Default.aspx">
     <input type="submit" style="display:none;">
    <input type="hidden" name="SortBy" value="@if (Dynamicweb.Input.FormatBoolean(GetValue("Server:Request.sortby"))) { GetValue("Server:Request.sortby"); }" />
    <input type="hidden" name="SortOrder" value="@if(Dynamicweb.Input.FormatBoolean(GetValue("Server:Request.sortorder"))) { GetValue("Server:Request.sortorder"); }" />

    @GetValue("B-filter1")
    @GetValue("A-filter2")

  </form>

You will get the filters in the order they are defined in the template (B-filter1 first then A-filter2).

Regards Thomas

 
Remi Muller
Reply

I noticed the same today :P

Maybe we should make a feature request to allow sorting of the filters?

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi Thomas,

Yes, that works but requires a developer to modify the template code. It would be a lot easier if a content manager could do this in the backend.

Remi: good idea.

 

Imar

 
Thomas Schroll
Reply

Sure that would be easier. A complete redesign of the filter setup would probably be a good idea. It would be nice with an easier handling of filters per group (http://developer.dynamicweb-cms.com/forum/ecommerce-standard-features/different-filters-per-group.aspx), improved visibility of dependencies of other filters and perhaps an auto update of index on save (or at least the possibility).

Regards Thomas

 

You must be logged in to post in the forum