Skip to content

Conversation

@carlosmauri
Copy link

@carlosmauri carlosmauri commented Aug 18, 2025

Hi @pkamps ,

I've removed the hardcoded sort by logic here:
extension/ezjscore/classes/ezjscserverfunctionsjs.php
to be able to read either a post variable or ini setting.

Now we can either use an ini setting to define the sort order we want to use globally or a new POST variable through the ajax call. Post variable will override the ini value (has higher priority)

The previous hardcoded value is now the default $sortBy value.

This PR needs to be combined with this one:
mugoweb/ezfind#26

Let me know if you have any questions or you see something wrong in the code.

Thank you!

PS. This is the original ticket where this was implemented https://app.assembla.com/spaces/mugo-development-general/tickets/620

@carlosmauri carlosmauri changed the title [#620] remove hardcoded sortBy to read its value either from ini or post var Remove hardcoded sortBy to read its value either from ini or post var [#620] Aug 18, 2025
@carlosmauri carlosmauri requested a review from pkamps August 18, 2025 14:37
@pkamps
Copy link
Member

pkamps commented Aug 20, 2025

Hi @carlosmauri,

there are some problems with this pull request. You're creating a dependency two extensions (ezjscore, ezfind). I believe you should move the ini setting from ezfind to ezjscore.

The search is allowing a few post parameters - non of those parameters is a json encoded string. I believe you should stick to simple post variable strings. Would it be possible to support POST var similar to this?

…ove 'SortByMethod' check (NZfrogs integration)
@carlosmauri
Copy link
Author

Hi @pkamps , nice catch. I've moved this new ezfind "SearchSettings" parameters within the ezjscore extension.
I've tested this using the AMNH backend and it looks fine.

On that 'SortByMethod' condition. I have removed it. I believe this was a custom solution when we implemented this for NZfrogs, otherwise I don't remember how to test this or where to find this functionality in the backend to be honest.
// check post variable if ( self::hasPostValue( $http, 'SortByMethod' ) ) { $sortBy = json_decode( $http->postVariable( 'SortByMethod' ), true ); }

In other words, now we have the ability to manage the SortBy from an INI instead of using that hardcoded value.

Let me know what you think.
Thanks!

@pkamps pkamps merged commit 36e53e6 into master Oct 18, 2025
@pkamps
Copy link
Member

pkamps commented Oct 18, 2025

Looks good. Thanks!

@pkamps pkamps deleted the 202508-620-sort-by-relevance-by-default branch October 18, 2025 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants