Developer forum

Forum » Development » Index sorting by code

Index sorting by code

Nuno Aguiar
Reply

Hi,

 

I know I've placed a feature request in the past, but I'd like to know if recent notifications and/or ideas to help us out.

 

We have a customer using the new index, but we have 2 pages (products and advanced search) with 5 sorting options each. The problem is that they each sorting option to be a group of options. Currently we have to have 1 page for each sorting group, meaning we have 5 product pages and 5 advanced search pages, but this means we have a lot more issues to solve when "remembering last sorting option".

 

If there an API notification or method we could use to change the sorting? This would allow us to have request something like "SortBy=Group1" and have the custom development map that to a set of fields with proper asc/desc settings.

 

This is multiplied by 10 languages, so every time there's a change we need to re-do the work 10 times and/or delete the language paragraphs and create a new language version.

 

Best Regards,

Nuno Aguiar


Replies

 
Nicolai Pedersen
Reply

I do not understand the scenario. Could you make a screendump?

You can use Sortby= & Sortorder= in the querystrings as always. I think you can also do Sortby=field1,field2,field3.

In 8.9.1 there is a new notification: OnAfterQueryParsed that can be used. See release notes. Same release contains your request for *whatever* searches (WARNING - it is slow and bad and you do not want the feature IRL)

BR Nicolai

 
Nuno Aguiar
Reply

Hi Nicolai,

 

Would be great if I could do Sortby=field1,field2,field3. You said a while ago this was not possible then, but I never picked up if it is possible now

http://doc.dynamicweb.com/forum/cms-standard-features/nex-index-query-sort-by-multiple-values?M=BasicForum&PID=1605

 

And here's what we currently need to do to get what the customer wants. When the user wants a new sorting we have to redirect them to a new page with the proper sorting settings

http://www.screencast.com/t/hQQAkDYC

 

Can you confirm the comma spitted values for SortBy and SortOrder query parameters? That would be great, otherwise we might try the new notification. I'd hate to keep it as it is right now. Too complex to manage.

 

Best Regards,

Nuno Aguiar

 
Nicolai Pedersen
Reply

Hi Nuno

Thanks - your whish was what I remembered. Just checked, and you cannot do that from QS yet... Sorry about that. It is in TFS as not done - that was what I remembered.

Thank you for the screendump - I understand your setup in the backend. But I do not understand the use case in the frontend. So I would like to see that...

Thanks, Nicolai

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

To control the sort order for multiple fields, would it make sense to prefix fields with a minus symbol? I think that's a common way to do it in APIs. I would prefer:

?SortBy=Field1,-Field2,Field3

over

?SortBy=Field1,Field2,Field3&SortOrder=Asc,Desc,Asc

Imar

 
Nicolai Pedersen
Reply

Yes, will take that into consideration. It has just been planned for this weeks sprint.

BR Nicolai

 
Nuno Aguiar
Reply

Hi Nicolai,

 

I just emailed you the URL to a search results page, and a dump where you can change the sorting. A few notes about this product list

  • We are listing variants
  • In the template we are grouping them by Product ID (hence sorted by Name)
  • We then sort them by price desc

 

Like many of our past projects, this is a "face-lift" of an existing website developed with another CMS platform.

 

Best Regards,

Nuno Aguiar

 
Nuno Aguiar
Reply

Hi Nicolai,

 

Did you get my email? I am curious if this made sense to you, as this implies a lot of manual work on our end and I am waiting to see if/when it can be done differently.

 

Best Regards,

Nuno Aguiar

 
Nicolai Pedersen
Reply

Yes I did.

Just approved this feature an hour ago and it will be released with 8.9.1 hotfix later today.

It supports both ways as Imar suggests.

BR Nicolai

 
Nuno Aguiar
Reply

That is perfect laugh

 

Thank you

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

>> Just approved this feature an hour ago and it will be released with 8.9.1 hotfix later today.

Could it be that it didn't make this release? I can see the changes in the code in Frontend.vb but not in the decompiled assembly for this version.

Thanks,

Imar

 
Nicolai Pedersen
Reply

Confirmed - it did not make the merge before hotfix release... Will get one out for you asap.

 

You must be logged in to post in the forum