reachweb / statamic-livewire-filters

Other
11 stars 0 forks source link

Allow sorting of taxonomy / select filter options #12

Open afonic opened 6 months ago

de-raaf-media commented 2 months ago

Will there also be an option to sort by the file modified date? Or is this already possible maybe?

{{ livewire:lf-checkbox-filter
  blueprint="products.product_variants"
  field="categorieen"
  condition="taxonomy"
  modifier="any"
}}
afonic commented 2 months ago

As you probably know taxonomies in Statamic are quite limited, so yes I'm working on various sorting solutions.

de-raaf-media commented 2 months ago

I am well aware of that. I have some taxonomies for months. They should - of course - be listed in the correct order otherwise it would not make sense. The solution I came up with is that I do some post processing here and there. One of these post processors is saving the month taxonomies in order of the months by updating the modified date of the file. But in the front end I have no option to sort them this way. I don't even know if there is a good solution for this without being able to add some kind of sorting to each term :-)

afonic commented 2 months ago

In our websites I usually create a Taxonomy terms field in a global config. Then, I can add the terms there and reorder them in order to load them at frontend using the correct order. And I can easily reorder them multiple times, remove one I don't need etc. The downside is that you need to also add a term there when you create a new one.

About Livewire Filters I am thinking of a solution like this, like a parameter "global_name.field" that is being used to load the terms and order them, or maybe a simple PHP array / YAML file that will load the order.

I'm still testing!

Ideally Livewire Filters could have a CP page for some settings etc but it's not planned atm.