Skip Navigation

[Closed] Suggestion

This support ticket is created 4 years 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: Africa/Casablanca (GMT+01:00)

This topic contains 8 replies, has 3 voices.

Last updated by Jamal 4 years ago.

Assisted by: Jamal.

Author
Posts
#2025981

Hey there !

Tell us what you are trying to do?
I need to search & sort the data on the page as per the following requirements.
*Sort by
Need to Add ‘Sort by’ dropdown menu having fields
Square footage | low to high
Square footage | high to low
Price | low to high
Price | high to low
Product number | ascending
Product number | descending

hidden link

Screenshot: hidden link

What is the link to your site?
hidden link
(credentials removed)

Kindly help us in suggesting in implementing sorting scenario

#2026039

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Can you please share admin access details that will help me to understand how exactly you configured your product listing view.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2029155

Hey there!

Did you get chance to review above comment, Kindly reply us asap

thank you

#2029157

Hey there!

Did you get chance to review my above comment, Kindly reply us asap

thank you

#2029499

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I see you have created another view and added the sorting controls to that view:
=> hidden link

Actually, you should add your sorting controls to your original view:
=> hidden link

Can you pleases move your sorting controls to your original view "final-filter-one":

More info:
=> https://toolset.com/documentation/legacy-features/views-plugin/allowing-visitors-to-sort-the-front-end-results/

#2030661

Hey there !

Thank you for your response, I still need assistance regarding it,

This is my page : hidden link
I want to sort data with "ajax without clicking on submit button"

Here on filter page i have option its for whole page

How do i set up sorting with ajax without search button
Screenshot: hidden link

Kindly guide me

thank you

#2030845

Hello! Minesh won't be available for a couple of days. If you don't mind, I'll continue with you on this ticket.

You can activate AJAX on the view ad configure it to trigger whenever a filter changes. Check this screenshot hidden link

However, for support rules, we are able to handle only one issue at a time. This helps us to bring you a better service and also helps other users to find all the information here exposed. For that reason, I have to kindly ask you to open a new thread or chat if you need assistance with something else.

If you believe that the original request of this thread was answered and resolved, please mark this ticket as resolved as well.

#2031493

Hey there!
As per your suggestion, the option affects every filter option on-page, that we don't want, can we just run "AJAX results update when visitors change any filter values" option for the sorting field/filter only, not for the below form, that we require to be submitted with search button.
Do we have a way we can filter ajax for sorting filter only that is set up on the page
kindly review the video for better understanding
hidden link
page: hidden link

thank you!

#2031555

If I understood well, you want the search form to be submitted using the submit button, but you want the sorting controls to trigger sorting using AJAX, right?
If that's the case, that is not supported out of the box. The sorting controls are part of the search form, the whole form will follow the view's configuration, either it uses AJAX or not, or either it triggers AJAX calls on any input change or when the submit button is clicked.

We can work around it using custom Javascript code. We'll configure the view to use AJAX after the user clicks on the submit button. And we'll add a custom Javascript code that will listen for changes on the sorting controls and programmatically trigger a click on the submit button. Something like:

// define the behviour
function ajaxifySorting(){
  // console.log('ajaxifySorting')
  var sorting = jQuery('.alignsortby');
  var selects = sorting.find('select')
  var submit = sorting.find('.wpv-submit-trigger')
  selects.on('change', function(){ 
     // console.log('selects changed => click on submit')
     submit.click() 
  })
}

// call the behviour on page load.
jQuery(ajaxifySorting);

// call the behaviour after the view completes an AJAX search
jQuery( document ).on( 'js_event_wpv_parametric_search_results_updated', function( event, data ) {
	/**
	* data.view_unique_id (string) The View unique ID hash
	* data.layout (object) The jQuery object for the View layout wrapper
	*/
	if (data.view_unique_id == 2254)
		ajaxifySorting()
});

You can read more about this event in this article https://toolset.com/documentation/programmer-reference/adding-custom-javascript-code-to-views-that-use-ajax/

However, the form is still triggered with AJAX when we change a filter on it. That's a bug or an exception and we need to understand what triggers it. For that, I need you to do the following:
- Try to remove all other views from that page and that view. hidden link hidden link
If that does not help, we'll need to isolate the issue from other parts of your website. Please check if the search filters(not the sorting) will trigger AJAX calls when:
- Only Toolset plugins are activated. It will tell us if there is an interaction issue with another plugin.
- The theme is set to a WordPress default like Twenty-Twenty. It will tell us if there is an interaction issue with your theme.
If the problem disappears, start activating one at a time to track where the incompatibility is produced.

If this does not help, I'll need to run some tests in a minimal setup, let me know if I can switch theme and deactivate other plugins, or if you can offer a staging site to analyze the issue on it instead of the live site.

The topic ‘[Closed] Suggestion’ is closed to new replies.