E
E
Egor Chebotarev2016-05-26 19:59:29
MODX
Egor Chebotarev, 2016-05-26 19:59:29

How to set up a filter in getPage modx?

1. Display resources via getPage here
2. Filter snippet + getPage code:

<?php
$out = array();
$category = isset($_GET['category']) ? strip_tags($_GET['category']) : '';
$categories = explode('|', $category);
if ($category != '') {
foreach ($categories as $categ) {
$out[] = 'category==%*' . $categ . '*%';
}
}
return implode(',' $out);


3. The result of getPage is loaded by ajax on this page , respectively, on it you can see the names of categories in the data-value of the li list and look at catalog.js in source.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Egor Chebotarev, 2016-05-26
@Egche

Understood. I messed up with the names of tv-parameters.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question