Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorting multiple fields #152

Open
maslme opened this issue Feb 1, 2019 · 3 comments
Open

Sorting multiple fields #152

maslme opened this issue Feb 1, 2019 · 3 comments

Comments

@maslme
Copy link

maslme commented Feb 1, 2019

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

@georgringer
Copy link
Contributor

Currently not possible

@maslme
Copy link
Author

maslme commented Feb 5, 2019

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

@ratron
Copy link

ratron commented Feb 3, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants