Roman  Kliuchko
Roman Kliuchko

Reputation: 499

Products sorting on indexByTaxon page

I'm trying to add ability to sort products by price and date. Are there any predefined methods to do that, or the only way is to implement them by hand? From sylius.yml we're getting such strange route:

%sylius.model.taxon.class%:
        field: permalink
        prefix: /t
        defaults:
            controller: sylius.controller.product:indexByTaxonAction
            sylius:
                template: SyliusWebBundle:Frontend/Product:indexByTaxon.html.twig

Which can be used like {{ path(taxon) }}. But just adding sorting parameter doesn't work for me. Any ideas?

Upvotes: 0

Views: 256

Answers (1)

Emii Khaos
Emii Khaos

Reputation: 10085

You need a version, which incorporates the Pull Request #2122. Either the latest master, or you fork the 0.11 branch and cherry pick this fix.

Then you can simply define in your config.yml to only override the required defaults:

sylius_core:
    routing:
        %sylius.model.taxon.class%:
            defaults:
                sylius:
                    sorting:
                        order: desc

Upvotes: 2

Related Questions