Category ordering on the "Frontend Search Settings" doesn't work

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Category ordering on the "Frontend Search Settings" doesn't work

This topic contains 12 replies, has 2 voices, and was last updated by alekosk alekosk 4 years, 8 months ago.

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #16370
    alekosk
    alekosk
    Participant

    Hi,

    I am creating the Frontend Search Settings and I add categories in the order I want them to appear. However the order is not kept.
    See attached file.

    Instead of the “Technology” categories with its subcategories to be first, in the frontend search box they are last!

    How to fix this? I tried to clear cache, forced inline CSS, etc.. but nothing.

    Thanks

    Attachments:
    You must be logged in to view attached files.
    #16372
    alekosk
    alekosk
    Participant

    Also as you see the subcategories are not ordered in the order they are in the settings..

    #16375
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    I quickly tried to re-create the issue on my test server, but it seems to be respecting the order I give it.

    Does the preview window on the back-end shows the same order? If it shows correctly, then it is very likely a cache related issue.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #16376
    alekosk
    alekosk
    Participant

    Hi Ernest,

    No, both previouew and front-end show incorrect order..
    They do not follow the order of the settings at all 🙁

    Cleared my cache, opened in incognito window, also cleared the cache through Ajax Search Pro settings but nothing.
    anything else?

    #16379
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    Are all of the categories selected individually?
    I did a further tests, but everything looks okay here. It should also correct if sub-categories are dragged under the wrong main category, but even then, the order is kept. From the screenshot, I don’t think this is the case.

    I have also looked up the source where the terms are printed, and that part looks correct, it uses the WordPress core get_terms(..) function, and the argument is set to respect the order of the given term IDs.

    Can you grant me FTP and Back-end access to a temporary test environment where I can test this? I feel like this is something specific, or maybe there is some sort of 3rd party filter that may alter the get_terms(..) function output. It could also be an unknown bug yet, I honestly don’t know, as I’m not able to re-create the problem for some reason.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #16387
    alekosk
    alekosk
    Participant

    Hi Ernest,

    Yes all of them selected individually.. Its weird that in the backend I see the correct structure but on the front end it’s messed..
    FTP Access I am not sure, back-end access could be possible…

    how to grant u the access?

    #16391
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    You can edit your initial post and use the secure fields, or mark your next reply as private, or upload a .txt file with the details, whichever suits you.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #16392
    alekosk
    alekosk
    Participant
    You cannot access this content.
    #16397
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi Alekos,

    Thank you, I was able to log-in and do some tests.

    I believe there is something affecting the built in get_terms() function. I have tested the order which the search requests the categories, which is the correct order:

    69, 3, 2, 42, 43, 49, 44, 45, 46, 47, 40, 38, 39, 70, 37, 63, 64, 51, 67

    ..but the functions returns them in this order (this is what is then outputted):

    2, 3, 40, 39, 38, 37, 42, 43, 44, 45, 46, 47, 49, 51, 69, 70, 63, 64, 67

    This should not be happening, and I have no idea why that function returns the incorrect order, and it would be probably a nightmare to debug it.

    Instead, I have quickly made a custom filter function, that replaces the current method of getting the terms bulk, at once, by getting them one-by-one, and then merging them to an array. Add this custom code to the functions.php in your theme/child theme directory (copy from line 3 only!). Before editing, please make sure to have a full site back-up just in case!

    This should hopefully fix the problem.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #16399
    alekosk
    alekosk
    Participant

    Ok, that did the trick!!

    Thanks alot Ernest, much appreciated!!

    #16400
    alekosk
    alekosk
    Participant
    You cannot access this content.
    #16401
    Ernest Marcinko
    Ernest Marcinko
    Keymaster
    You cannot access this content. Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #16403
    alekosk
    alekosk
    Participant
    You cannot access this content.
Viewing 13 posts - 1 through 13 (of 13 total)

You must be logged in to reply to this topic.