Different sorting only for one CP Search module

  • marcinnader
  • Autore della discussione
  • Offline
  • Nuovo Utente
  • Nuovo Utente
Di più
6 Anni 8 Mesi fa - 6 Anni 8 Mesi fa #2592 da marcinnader
Different sorting only for one CP Search module è stato creato da marcinnader
Hello!
I face problem I can't solve. On my website I use few CP Search modules. Each of them has different result page with its own template override and Itemid defined. Results generally are sorted alphabetical but on one page I have to sort them in another way (newest first). There isn't such parameter in module but it is located only in component properties and it applies to all modules/result pages. How distinguish only this one module/result page from the rest and apply different sorting method?
Thanks in advance!
Ultima Modifica 6 Anni 8 Mesi fa da marcinnader.

Si prega Accesso o Crea un account a partecipare alla conversazione.

Di più
6 Anni 8 Mesi fa #2593 da andrea_4g
Risposta da andrea_4g al topic Different sorting only for one CP Search module
Hi.
There's no clean way to address this request.

There's only a quick & unelegant method I can think of: modify a core file.
It's a very minimal modification that will be overwritten when / if you update Custom Properties.

Edit file components\com_customproperties\models\search.php

add the following code after line 110:
Code:
if($app->input->get('Itemid', '', 'int') == '117') { $ordering = 'newest'; }

Adjust "117" to match the menu Item ID you want to apply the forced ordering to.

Note: on this page the dropdown ordering selector will not have any effect.
I seguenti utenti hanno detto grazie : marcinnader

Si prega Accesso o Crea un account a partecipare alla conversazione.

  • marcinnader
  • Autore della discussione
  • Offline
  • Nuovo Utente
  • Nuovo Utente
Di più
6 Anni 8 Mesi fa #2594 da marcinnader
Risposta da marcinnader al topic Different sorting only for one CP Search module
Thank you so much.

Si prega Accesso o Crea un account a partecipare alla conversazione.

Tempo creazione pagina: 0.125 secondi