tt_address icon indicating copy to clipboard operation
tt_address copied to clipboard

Sorting multiple fields

Open maslme opened this issue 6 years ago • 3 comments

Hello @all, in my opinion it's not possible sorting tt_address items following multiple fields - for example sorting at first by name, than by first_name or sorting first by city, than by address or something else.

Is there any possibility via typoscript - I can't find anything in the documentation.

tt_address: 4.0.1

maslme avatar Feb 01 '19 08:02 maslme

Currently not possible

georgringer avatar Feb 04 '19 11:02 georgringer

Thanks for your reply @georgringer - than I would appreciate if you could make a note of this as a feature request.

maslme avatar Feb 05 '19 08:02 maslme

three years late, but here's a "solution":

change line 68 in master / line 60 in tag 5.3 in /Classes/Domain/Repository/AddressRepository.php:

replace

            $query->setOrderings([$sortBy => $order]);

with:

            $sortByFields = explode(",",$sortBy);
            $orderings = [];
            foreach($sortByFields as $field){
                $orderings[$field] = $order;
            }
            $query->setOrderings($orderings);

then you can set the fields comma separated in typoscript:

plugin.tx_ttaddress.settings.sortBy = country,city

...of course you have to clone the repository if you want to be able the migrate later.

ratron avatar Feb 03 '22 17:02 ratron