Default 'selected' <option> in browse item view


how can one change the default behaviour in the browse items page (/s/site/item)? As it is now the items are by default sorted by ‘created’. I’d like them sorted by title by default, or an easy-ish way to control that behaviour.

I can’t find it in application/view/common/sort-selector.phtml. I’ve found it for the browse preview (src/Site/BlockLayout/BrowsePreview.php), not for the full browse.

I know I can append ?sort_by=title to the address. But then when the user does an advanced search and clicks the ‘search’ button the custom behaviour is restored (unless I append the parameters with some JavaScript or edit the ‘search’ action).

Any help would be very appreciated.

The search order is set in ItemController::browseAction()
If you look at this action, you’ll find the following line:


You can either hard code your own search default in place of the existing, modifying the line like this:

$this->setBrowseDefaults('title', 'asc');

Or I guess you can create your own module that looks for the corresponding event and modifies the order preferences accordingly.


Amazing, thank you for this.

This topic was automatically closed 250 days after the last reply. New replies are no longer allowed.