What is the default sub-sort?

This topic contains 15 replies, has 3 voices, and was last updated by  Hui Ling Tan 4 years, 5 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #516570

    Hui Ling Tan
    Expired Member
    Post count: 349

    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
    Title

    Are 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?

    #516579

    Alex Rollin
    Moderator
    Post count: 27815

    I’m sorry, could you say more about what you are trying to do?

    #516606

    Hui Ling Tan
    Expired Member
    Post count: 349
    This reply has been marked as private.
    #516617

    Alex Rollin
    Moderator
    Post count: 27815

    OK, 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?

    #517174

    Hui Ling Tan
    Expired Member
    Post count: 349

    Ok 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.

    #517188

    Alex Rollin
    Moderator
    Post count: 27815

    No, but I will take that as a suggestion for the developers to consider for future versions.

    #517412

    Hui Ling Tan
    Expired Member
    Post count: 349

    Hi Alex,

    I just did a test and followed your instructions but the sub-sorts doesn’t seem to be turning out as expected.

    #517413

    Hui Ling Tan
    Expired Member
    Post count: 349
    This reply has been marked as private.
    #517424

    Alex Rollin
    Moderator
    Post count: 27815
    This reply has been marked as private.
    #517440

    Kiran
    Moderator
    Post count: 7069

    Hi 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,
    Kiran

    #517458

    Hui Ling Tan
    Expired Member
    Post count: 349

    Thanks 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 – Descending

    By 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?

    #517459

    Hui Ling Tan
    Expired Member
    Post count: 349

    Thank 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!!

    #517460

    Kiran
    Moderator
    Post count: 7069

    The 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

    #517470

    Hui Ling Tan
    Expired Member
    Post count: 349
    This reply has been marked as private.
    #517563

    Alex Rollin
    Moderator
    Post count: 27815

    Those listings are being skipped because they do not have a value for Price Range.

Viewing 15 posts - 1 through 15 (of 16 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket