Skip Navigation

[Resolved] Sort controls in view not overriding the default sort order

This thread is resolved. Here is a description of the problem and solution.

Problem:

I am trying to: allow front-end user to custom sort a view with the controls proviced

I expected to see: However, I have provided controls to change between Price and Post Date, and also Ascending and Descending, but these controls have not effect

Instead, I got: the same price ascending output, which is the default. The custom sort controls are ignored. The other filters work just fine against custom fields and taxonomies.

Solution:

I have checked it in your website, after submit the search form, there is a URL parameter missing:
wpv_view_count=94-TCPID91

Please try this:
Edit the view "Search View", in section "Filter Editor", add below codes just before [wpv-filter-end]:

<input class="wpv_view_count wpv_view_count-94-TCPID91" type="hidden" name="wpv_view_count" value="94-TCPID91" />

And test again.

Relevant Documentation:

This support ticket is created 6 years, 7 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 7 replies, has 2 voices.

Last updated by Luo Yang 6 years, 7 months ago.

Assisted by: Luo Yang.

Author
Posts
#710942
Screenshot (262) order by price.png
Screenshot (263) filter editor.png
Screenshot (264) sort order and choice controls.png

I am trying to: allow front-end user to custom sort a view with the controls proviced

Link to a page where the issue can be seen: hidden link
User name: elcustomer, password: 21gaBS167GA
Click Search in the top menu, then filter on Sale Status "For Sale". You can see that output is price ascending.

I expected to see: However, I have provided controls to change between Price and Post Date, and also Ascending and Descending, but these controls have not effect

Instead, I got: the same price ascending output, which is the default. The custom sort controls are ignored. The other filters work just fine against custom fields and taxonomies.

I hope you can spot what I am missing here. Many thanks.

Steve

#713493

Hello,

I have tried the URL you mentioned above, but can not see the search form as your screenshot:
hidden link

Is this problem resolved?
And the problem you mentioned above is abnormal, in case it is a compatibility problem, please try this:
1) deactivate other plugins and switch to wordpress default theme 2017, and test again
2) If the problem still persists, please provide a database dump file (ZIP file) of your website in below private detail box, I need to test and debug it in my localhost, thanks

#714959

Thanks for the details, I am downloading the file, will feedback if there is anything found

#722847

Here are what I found,
1) after import the database dump file you provided in a fresh wordpress installation, the menu item "Search" does not work as your website and screenshot, it dispaly a text "WP Views Filter", so can not duplicate the same problem with your database dump file.

2) I have checked it in your website, after submit the search form, there is a URL parameter missing:
wpv_view_count=94-TCPID91

Please try this:
Edit the view "Search View", in section "Filter Editor", add below codes just before [wpv-filter-end]:

<input class="wpv_view_count wpv_view_count-94-TCPID91" type="hidden" name="wpv_view_count" value="94-TCPID91" />

And test again.

#726154

Hi Luo,

Thank you. Yes, fantastic. That worked!

Can you just explain the solution please? I don't know how I would have come up with that myself, and it would be good to understand for future reference.

Many thanks.

Steve

#731197

As I mentioned above:
there is a URL parameter missing in your website:
wpv_view_count=94-TCPID91
It is required parameter of views custom search form,

you can get the HTML codes in your own website:
view-source:hidden link
Line 409:

<input class="wpv_view_count wpv_view_count-94-TCPID91" type="hidden" name="wpv_view_count" value="94-TCPID91" />

number 94 is your view's ID, number 91 is target page ID.

#732667

Thank you Luo

#732839

You are welcome