251 Posts
Viktor Iwan
10 years ago
2
Topic

Hello, i just purchase Search Ordering add-on.. i found a problem.

if you want to create this kind of ordering:

This is where you want to order the Title based on Alphabet... with the above setting, you will likely get only sort by Title Z-A... you will miss the option Title A-Z


WHY ?

because it using the same art_title !


Solution :

At current version (at this time of writing), the field is processed on search_ordering.php in function _getChildren()

If you take a look at the query:

--------------------------------------

$query   =    'SELECT a.name, a.label, a.type, a.storage_table, a.storage_field, a.storage_field2'
         .   ' FROM #__cck_core_fields AS a'
         .   ' WHERE a.name IN ('.$names.') ORDER BY FIELD(name, '.$names.')'
         ;
 $fields   =   JCckDatabase::loadObjectList( $query );

----------------------------------------

when the $names are "art_created","art_title","art_title","art_hits"

this query will result only 3 item, since art_title is double


Get a Book for SEBLOD
154 Posts
WebOne
10 years ago
1
Level 1

I read somewhere you can create another dummy/alias field (with different field name) pointing to the same table/column and use that. (eg. for Title Z-A).

251 Posts
Viktor Iwan
10 years ago
0
Level 2

It Works !.. thanks @webone and @lionel who giving me this nice trick...

i'll post a video for this trick....

Get a VIP membership