mFilter2. принцип OR поменять на AND

  1. Меняем класс обработчик фильтров. Идем в настройки системы и в настройках mSearch2 меняем параметр mse2_filters_handler_class на CustomFilter
  2. Теперь нам нужно создать сам класс. Для этого создаем файл "core/components/msearch2/custom/filters/custom.class.php" с содержимым
class CustomFilter extends mse2FiltersHandler {

    public function getMsOptionMyValues(array $keys, array $ids) {
		$filters = array();
		$q = $this->modx->newQuery('msProductOption');
		$q->where(array('product_id:IN' => $ids, 'key:IN' => $keys));
		$q->select('`product_id`,`key`,`value`');
		$tstart = microtime(true);
		if ($q->prepare() && $q->stmt->execute()) {
			$this->modx->queryTime += microtime(true) - $tstart;
			$this->modx->executedQueries++;
			while ($row = $q->stmt->fetch(PDO::FETCH_ASSOC)) {
				$value = trim($row['value']);
				if ($value == '') {continue;}
				$key = $row['key'];
				// Get ready for the special options in "key==value" format
				if (strpos($value, '==')) {
					list($key, $value) = explode('==', $value);
					$key = preg_replace('/\s+/', '_', $key);
				}
				// --
				if (isset($filters[$key][$value])) {
					$filters[$key][$value][] = $row['product_id'];
				}
				else {
					$filters[$key][$value] = array($row['product_id']);
				}
			}
		}
		else {
			$this->modx->log(modX::LOG_LEVEL_ERROR, "[mSearch2] Error on get filter params.\nQuery: ".$q->toSql()."\nResponse: ".print_r($q->stmt->errorInfo(),1));
		}
		return $filters;
	}

	public function buildDefaultMyFilter(array $values, $name = '') {
		if (count($values) < 2 && empty($this->config['showEmptyFilters'])) {
			return array();
		}
		$results = array();
		foreach ($values as $value => $ids) {
			$results[$value] = array(
				'title' => $value
				,'value' => $value
				,'type' => 'default'
				,'resources' => $ids
			);
		}
		ksort($results);
		return $results;
	}
	

    public function filterDefaultMy(array $requested, array $values, array $ids) {
		$matched = array();
		$tmp = array_flip($ids);
		foreach ($requested as $value) {
			if (isset($values[$value])) {
				$resources = $values[$value];
				foreach ($resources as $id) {
					if (isset($tmp[$id])) {
						$matched[] = $id;
					}
				}
			}
		}
		
	    $match = $matched;
		$matched = array();
		$count = count($requested);
		$count_values = array_count_values($match);
		foreach ($count_values as $id => $value) {
		    if ($value >= $count) {
		        $matched[] = $id;
		    }
		    else {
		        $matched[] = 0;
		    }
		}
		return $matched;
	}
	
}

осталось добавить в чанк вызова mFilter2 строчку

&filters=`
		msoption|tags:DefaultMy`
Яндекс.Метрика Рейтинг@Mail.ru