Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Формируем ID производителей для выборки
- if (!empty($_GET['brand'])) {
- $tmp = explode(',', preg_replace('([^0-9,])', '', $_GET['brand']));
- $brands = array();
- foreach ($tmp as $v) {
- if ( intval($v) != 0 ) $brands[] = (int) $v;
- }
- $this_id = $modx->resource->get('id');
- $childs = $modx->getChildIds($this_id,1,array('context' => 'web'));
- $brandsArr = array();
- foreach ($brands as $brand) {
- if(in_array($brand, $childs)) $brandsArr[] = $brand;
- }
- $parents = count($brandsArr) > 0 ? implode(',',array_unique($brandsArr)) : '';
- }
- // Дальше переменную $parents я засовываю в $output = $modx-runSnippet('getResources',array('parents' => $parents))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement