Skip Navigation

[Resolved] Is it possible to have 4 options within 1 Sort box? lowtoHigh HIghtoLow Newold..

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

Problem:
Is it possible to have lowtoHigh HIghtoLow sorting options.

Solution:
Currently, you do not have lowtoHigh/HIghtoLow sorting options but we take it as a new feature request and we will add this feature to our plugin in near future. Please note that there is no ETA on this.

You can find the proposed solution in this case with the following reply:
https://toolset.com/forums/topic/is-it-possible-to-have-4-options-within-1-sort-box-lowtohigh-hightolow-newold/#post-1787673

Relevant Documentation:

This support ticket is created 3 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 14 replies, has 3 voices.

Last updated by danielM-30 3 years, 6 months ago.

Assisted by: Minesh.

Author
Posts
#1773723
IMG_9170.jpg

Tell us what you are trying to do?
I want my Sorting to be one box with a dropdown of 4 options
Is there any documentation that you are following?

Is there a similar example that we can see?
I have an example attached
What is the link to your site?
hidden link

#1774029

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+00:00)

Hello and thank you for contacting the Toolset support.

If you are building your view with the legacy editor, you can use the sorting control button to add this type of sorting. Check this screenshot hidden link
Then you can choose on what to sort and how(ascending, descending), check this screenshot hidden link

If you are using the Block editor, you will have the sorting block which will offer the same UI as my last screenshot.

If you find trouble implementing this, let me access your backend and I'll prepare an example for you. Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **

#1777113

Minesh
Supporter

Languages: English (English )

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

Jamas is busy doing other stuffs. I'm stepping-in and will take care of this ticket. Hope this is OK.

Currently - its not possible to implement one sorting dropdown that will allow you to sort the results.

But I shared your thoughts with concern person and we will try to add this feature to Blocks in near future release. Please note that there is no ETA on it.

You can also raise your voice by filing a new feature request using the following form:
=> https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/

For now, the only workaround is you will require to use the two dropdowns where one dorpdown will offer the field to sort by with and another dropdown will offer the sorting direction (ASC / DESC).

#1780693
IMG_9235.jpg

Good evening

I have put a request for a new feature to have a sort with a dropdown of 4 options.
In the meantime I currently have two boxes
First box - a label box titled 'Sort by Price'
Second box - a drop down with the options of 'High to Low' and Low to HIgh'

Could you possibly help by removing the arrow after 'Sort by Price' (see example).

BASICALLY I dont want the user to have to do 2 drop downs boxes to sort their results. I just want one box to have the drop down option

If you can please help I would be very grateful.

Dan

#1780963

Minesh
Supporter

Languages: English (English )

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

Can you please check now: hidden link

I've added the following CSS code at: Appearance => Customize => Additional CSS section:

select[name='wpv_sort_orderby'] {
  /* for Firefox */
  -moz-appearance: none;
  /* for Chrome */
  -webkit-appearance: none;
} 

I can see now the dropdown icon is removed.

#1784713
IMG_9277.jpg

Hi Minesh

Thanks for looking into this.

when you first go onto that page the sort boxes show the wrong information - 'Post date' is appearing in one box and 'Ascending/Decending' is appearing in the other box - SEE IMAGE
AND after I have clicked in the sort box and selected 'Price' the 'Post date' then disappears. Is this a glitch or can it be resolved?

#1784723

also.. when I switch to 'Low-High' it's incorrect.
'High- low' is totally fine, gives me the correct results. Why would 'Low-High' fail to work?

please help.

#1785641

Minesh
Supporter

Languages: English (English )

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

when you first go onto that page the sort boxes show the wrong information - 'Post date' is appearing in one box and 'Ascending/Decending' is appearing in the other box - SEE IMAGE
==>
This is known issue and will be addressed in near future. I've already added your voice to our internal ticket and will update when we publish the fix for this issue.

Do you mean that sorting is not working when you sort in Descending order?

#1785889

hello Minesh.

Yes, it dosent seem to work when switching to descending order.

#1785953

Minesh
Supporter

Languages: English (English )

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

I just checked and select the "price" as sorting field and selected "High to Low" and I can see its displaying the correct results.

As you can see here:
hidden link

I can see the first item price is 91000 that is highest.

#1786549

Yes I know this is correct - its the Low to High thats not
Please help resolve

#1787015

Minesh
Supporter

Languages: English (English )

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

The thing was that, you are sorting the results using the custom field that is created using the ACF plugin.

Can you please check now: hidden link

I've added the following view's filter hook to "Custom Code" section offered by Toolset:
=> hidden link

add_filter( 'wpv_filter_query', 'func_orderby_price_numeric', 10, 3 );
function func_orderby_price_numeric( $query_args, $view_settings,$view_id ) {
     
if($view_id == 1936)  {   
  if(isset($_GET['wpv_sort_orderby']) and $_GET['wpv_sort_orderby']=='field-price'){  
     $query_args['orderby'] = array( 'meta_value_num');
      $query_args['meta_type'] = 'numeric';   
  }  
       
  }    
return $query_args;
}

I verified and checked now, both "high to low" and "low to high" sorting shows expected results. Can you please verify.

#1787645

Search now shows expected results, thank you for doing this.

Is there any change to the following glitch raised- Message from 21st September
"when you first go onto that page the sort boxes show the wrong information - 'Post date' is appearing in one box and 'Ascending/Decending' is appearing in the other box - "
AND after I have clicked in the sort box and selected 'Price' the 'Post date' then disappears. Is this a glitch or can it be resolved?

==> Minesh September 22nd 10:O3am -
This is known issue and will be addressed in near future. I've already added your voice to our internal ticket and will update when we publish the fix for this issue.

#1787673

Minesh
Supporter

Languages: English (English )

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

Ok - to remove the date field from the sorting control, I've added the following JS to your view's CSS and JS editor:

jQuery(document).ready(function($){
  
    $('select[name="wpv_sort_orderby"] option[value="post_date"]').remove();
});

Then, i've set your view to order the the price field as you can see with the following screenshot:
=> hidden link

And I've adjusted the code I've added to "Custom Code" section as given under:

add_filter( 'wpv_filter_query', 'func_orderby_price_numeric', 10, 3 );
function func_orderby_price_numeric( $query_args, $view_settings,$view_id ) {
     
if($view_id == 1936)  {   
 // if(isset($_GET['wpv_sort_orderby']) and $_GET['wpv_sort_orderby']=='field-price'){  
     $query_args['orderby'] = array( 'meta_value_num');
      $query_args['meta_type'] = 'numeric';   
 // }  
       
  }    
return $query_args;
}

Can you please confirm it works as expected now.

#1787685

Brilliant!!
Thank you Minesh.

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