I
I
IT-sorce2021-08-01 17:32:04
OctoberCMS
IT-sorce, 2021-08-01 17:32:04

How do I filter on the front by multiple October CMS values?

How can I filter the data by several parameters
6106afbaf2365621187668.png
filter
Shows only the last checkbox

public function scopeListFrontEnd($query, $options = [])
    {
         if($_SERVER['REQUEST_URI'] == '/') {
             extract(array_merge([
                'page'             => 1,
                'perPage'          => 18,
                'sort'             => 'updated_at desc',
                'townships'       => null,
                'exceptTownships' => null,
                'township'         => null,
                'search'           => '',
                'published'        => true,
                'country_id'      => '',
                'state_id'         => '',
                'avto__privid'     => '',
                'avto__prignan'    => '',
                'avto__kpp'        => '',
                'avto__palyvo'     => '',
                'avto__price__value_min' => '',
                'avto__price__value_max' => '',
                'avto__obdvigyna__value_min' => '',
                'avto__obdvigyna__value_max' => '',
                'avto__year__value_min' => '',
                'avto__year__value_max' => '',
                'avto__type__car' => '',
                'type_ogolosheny_seller' => 'no',
                'exceptKvartus'       => null,
         ], $options));
.........

 if($avto__privid){
            $query->where('avto__privid', '=', $avto__privid);
        }

Code on layout
{% for avto__privid in 	avto__privids %}
<label class="content-radio-filtre avto__privid-label" {% if avto__privid %}{% else %}style="display:none;"{% endif %}>
    <input type="checkbox" name="Filter[avto__privid]" class="name_select_avto__privid" value="{{avto__privid}}" hidden>
    <i>{{ avto__privid }}</i>
    <span class="check"></span>
</label>
{% endfor %}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question