Different sorting only for one CP Search module

  • marcinnader
  • Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 7 months ago - 6 years 7 months ago #2592 by 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!
Last edit: 6 years 7 months ago by marcinnader.

Please Log in or Create an account to join the conversation.

More
6 years 7 months ago #2593 by andrea_4g
Replied by andrea_4g on 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.
The following user(s) said Thank You: marcinnader

Please Log in or Create an account to join the conversation.

  • marcinnader
  • Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 7 months ago #2594 by marcinnader
Replied by marcinnader on topic Different sorting only for one CP Search module
Thank you so much.

Please Log in or Create an account to join the conversation.

Time to create page: 0.157 seconds