What is the default sub-sort?
This topic contains 15 replies, has 3 voices, and was last updated by  Hui Ling Tan 5 years, 11 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket- 
		AuthorPosts
 - 
		
			
				
November 11, 2019 at 9:01 am #516570
Hi I actually have 2 questions here.
1) If I sort by Rating for example, and there are listings with the same rating, what is the default sub sort?
2) I’m confused by this part of GD documentation.
https://wpgeodirectory.com/docs-v2/places/sorting/
It says
“For example, the first sort is by Title (alpha), then within all the listings starting with “A”, sort them again by which are highest rated.You can set this ‘sub-sort’ up like so:”
The image posted below is something like this
Title
Random
Review
Rating
TitleAre you trying to say that there are 2 sort options for the users:
Sort by Title &
Sort by Rating.And for the “sort by title”, within all the listings starting with “A”, they are being sort by Random?
November 11, 2019 at 10:17 am #516579I’m sorry, could you say more about what you are trying to do?
November 11, 2019 at 12:21 pm #516606This reply has been marked as private.November 11, 2019 at 1:24 pm #516617OK, so that is two sorts with subsorts.
First first, descending, with subsort random.
Then if your Price select has values 1,2,3,4 it is orted Ascending with subsort for featured-descending and then random.Have you tried that? Is it not working?
November 14, 2019 at 5:34 pm #517174Ok I got that sorted out.
It seems like the sub-sort by default is Date Added am I right?
Eg. for Price Select with values 1,2,3,4 in your example, if I don’t implement any sub-sort to the “Sort by Price: Ascending”, listings with value 1 will always appear with the latest added listing and ending with the listing that was added first.
Is there a way to change the default sub-sort to Random instead?
I have many CPTs, multiplied by the number of sorts can make it a tedious task to add “random” subsort to every sort.
November 14, 2019 at 6:54 pm #517188No, but I will take that as a suggestion for the developers to consider for future versions.
November 16, 2019 at 6:39 am #517412Hi Alex,
I just did a test and followed your instructions but the sub-sorts doesn’t seem to be turning out as expected.
November 16, 2019 at 6:41 am #517413This reply has been marked as private.November 16, 2019 at 7:29 am #517424This reply has been marked as private.November 16, 2019 at 10:15 am #517440Hi Hui,
With random sorting it cache the results(when loaded first time) for 24 hours.
Try following PHP snippet to refresh random sorted results on each page refresh.
add_filter( 'geodir_rand_seed', '__return_null' ); // Random results on each refresh.Regards,
KiranNovember 16, 2019 at 12:08 pm #517458Thanks Kiran and Alex.
The problem is not with the Price Range or Random.
It’s with the sub-sort Featured field.
Main Sort: Price Range
Sub Sort: Featured – DescendingBy right if Featured is set to Descending, listings in the same “Price Range” should have the Featured Listings appearing first, followed by the non-featured ones am I right?
November 16, 2019 at 12:15 pm #517459Thank you so much Kiran for the snippet. The Featured field is still not resolved but the snippet has really hit the nail for the Random sort.
It’s exactly what I need for the Random Sort!!
November 16, 2019 at 12:29 pm #517460The Featured field is still not resolved.
Sorting works as expected as per setup. Let us know what you found wrong there.
First two listings have set price range, that’s why both listings are at the top of the results in ascending order.
Kiran
November 16, 2019 at 1:25 pm #517470This reply has been marked as private.November 17, 2019 at 7:54 pm #517563Those listings are being skipped because they do not have a value for Price Range.
 - 
		AuthorPosts
 
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket