Skip Navigation

[Resolved] Conditional Orderby Dropdown Options

This support ticket is created 6 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 32 replies, has 3 voices.

Last updated by Beda 6 years, 9 months ago.

Assisted by: Beda.

Author
Posts
#558926

OK - after a valuable input of the Developer, and once more a full test series, I have to state that this is expected.

It happens also with Post Fields Query, I discovered now.

When your URL includes a sorting by a parameter that is not included in the current sort controls that you are displaying, it is added “magically” so the sorting option that appears as selected in that control matches and is in sync with the current actual sorting.

This is built in.

If you manually manipulate the URL and include anything as the value of the wpv_sort_orderby parameter, it will also appear as a sorting option in the control, although you might end up with no results, of course.

And that is exactly what happens when we:
- query by anything
- then sort by anything
- then query again by anything else,
the sort by value is STILL in the URL.

Unfortunately, there is nothing we can do here from the POV of code.

What you have to do to avoid this, is to first reset that URL parameter.
And that can safely be done only with a reset button.
(or any other method that removes this particular argument from the URL entirely)

I am really sorry the length of this thread and that now, there is no solution but it is expected.

The safest and best solution is to reset the URL before you let the user filter again, in this very particular situation.

#558970

Joe

Thank you Beda.

I understand that this may be outside the scope of this forum, but I will ask. Is there some script that can be used to reset the orderby to "brand" each time the quantity gets updated? This may be a suitable solution.

#559126

You would need to remove the URL parameter for the Order By on click.
https://stackoverflow.com/questions/1634748/how-can-i-delete-a-query-string-parameter-in-javascript
https://stackoverflow.com/questions/16941104/remove-a-parameter-to-the-url-with-javascript

This falls under Custom Code, and please keep in mind, that it will, of course, reset the Order by, if the argument is removed.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.